.portal-page {
  min-height: 100vh;
  background: #f5f8fa;
}

.chatwoot-context-bar {
  display: grid;
  margin: -8px 0 20px;
  padding: 14px 16px;
  gap: 3px;
  border: 1px solid #dce4f7;
  border-radius: 14px;
  background: #f3f6ff;
}

.chatwoot-context-bar[hidden] {
  display: none;
}

.chatwoot-context-bar span {
  color: #2458d8;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chatwoot-context-bar strong {
  color: #111827;
  font-size: 15px;
}

.chatwoot-context-bar small {
  color: #667085;
  font-size: 11px;
}

html[data-chatwoot-embed="true"],
html[data-chatwoot-embed="true"] body {
  min-width: 300px;
  background: #f8fafc;
}

html[data-chatwoot-embed="true"] .top-strip,
html[data-chatwoot-embed="true"] .portal-header,
html[data-chatwoot-embed="true"] .portal-intro,
html[data-chatwoot-embed="true"] [data-admin-tab="support"] {
  display: none !important;
}

html[data-chatwoot-embed="true"] .portal-main {
  width: 100%;
  max-width: none;
  padding: 12px;
}

html[data-chatwoot-embed="true"] .chatwoot-context-bar {
  margin: 0 0 12px;
}

html[data-chatwoot-embed="true"] .auth-panel,
html[data-chatwoot-embed="true"] .admin-dashboard,
html[data-chatwoot-embed="true"] .member-section {
  border-radius: 14px;
}

html[data-chatwoot-embed="true"] .admin-tabs {
  padding-bottom: 4px;
  overflow-x: auto;
  flex-wrap: nowrap;
}

html[data-chatwoot-embed="true"] .admin-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

html[data-chatwoot-embed="true"] .section-heading.compact-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}

html[data-chatwoot-embed="true"] .admin-member-search {
  width: 100%;
}

.portal-page [hidden] {
  display: none !important;
}

.portal-strip {
  justify-content: flex-start;
  padding-left: clamp(18px, 5vw, 72px);
}

.portal-header {
  position: relative;
}

.support-workbench .brand-logo {
  width: 42px;
  height: 30px;
}

.portal-nav,
.portal-account,
.auth-form-links,
.profile-actions,
.order-head,
.order-meta,
.order-actions,
.admin-order-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.portal-nav {
  margin-left: auto;
  font-weight: 800;
}

.portal-nav a:hover {
  color: var(--teal-dark);
}

.portal-account span {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 58px 0 80px;
}

.portal-intro {
  max-width: 720px;
  margin-bottom: 28px;
}

.portal-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.06;
}

.portal-intro > p:last-child,
.compact-heading > p {
  color: var(--muted);
}

.portal-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid rgba(199, 122, 36, 0.32);
  border-radius: 8px;
  background: #fff8ed;
}

.portal-notice[hidden] {
  display: none;
}

.portal-notice p {
  margin: 4px 0 0;
  color: #715331;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 18px 46px rgba(17, 32, 51, 0.08);
}

.auth-copy,
.auth-form-wrap {
  padding: clamp(24px, 4vw, 44px);
}

.auth-copy {
  background: var(--ink);
  color: white;
}

.auth-copy h2 {
  margin-bottom: 20px;
  font-size: 30px;
}

.auth-copy ul {
  display: grid;
  gap: 13px;
  margin: 0;
  padding-left: 20px;
  color: #d9e3ed;
}

.auth-form-wrap {
  display: grid;
  align-content: center;
}

.auth-form-wrap form,
.profile-form label,
.admin-field {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.auth-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.auth-input-row input,
.profile-form input,
.admin-field input,
.admin-field select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}

.auth-input-row input:focus,
.profile-form input:focus,
.admin-field input:focus,
.admin-field select:focus {
  outline: 2px solid rgba(29, 124, 120, 0.24);
  border-color: var(--teal);
}

.auth-form-links {
  margin-top: 10px;
}

.field-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.privacy-consent {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600 !important;
}

.privacy-consent input {
  width: 16px;
  height: 16px;
}

.privacy-consent a {
  color: var(--teal-dark);
  font-weight: 800;
}

.field-message.is-error {
  color: var(--danger);
}

.member-dashboard {
  display: grid;
  gap: 24px;
}

.member-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--ink);
  color: white;
}

.member-summary div {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.member-summary div:last-child {
  border-right: 0;
}

.member-summary span,
.member-summary strong {
  display: block;
}

.member-summary span {
  margin-bottom: 7px;
  color: #b9c9d7;
  font-size: 13px;
}

.member-summary strong {
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
}

.member-section {
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line);
  background: white;
}

.compact-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.compact-heading h2 {
  margin: 0;
  font-size: 28px;
}

.compact-heading > p {
  margin: 0;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.profile-wide {
  grid-column: 1 / -1;
}

.profile-actions {
  justify-content: space-between;
}

.orders-list {
  display: grid;
  gap: 14px;
}

.portal-empty {
  padding: 32px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.order-head {
  justify-content: space-between;
  padding: 16px 18px;
  background: #f7fafb;
}

.order-number {
  font-weight: 900;
}

.status-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: #e9f5f1;
  color: #23684a;
  font-size: 12px;
  font-weight: 900;
}

.status-badge.is-pending {
  background: #fff2dd;
  color: #8d5718;
}

.order-body {
  padding: 18px;
}

.order-items {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.order-item-line,
.order-total-line,
.order-meta {
  justify-content: space-between;
}

.order-item-line,
.order-total-line {
  display: flex;
  gap: 16px;
}

.order-total-line {
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 900;
}

.member-price-adjustment,
.admin-price-adjustment {
  color: #a53b30;
  font-weight: 800;
}

.order-meta {
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.order-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.order-serials {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  background: #f7fafb;
}

.order-serials h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.order-serial-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.order-serial-line strong {
  font-variant-numeric: tabular-nums;
}

.order-serial-line a {
  color: var(--teal-dark);
  font-weight: 850;
}

.tracking-panel {
  margin-top: 14px;
  padding: 14px;
  background: #f7fafb;
}

.tracking-panel ol {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.tracking-panel time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.member-payment-dialog {
  width: min(92vw, 520px);
}

.member-payment-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: #eef3f5;
  color: var(--ink);
}

.member-payment-content {
  display: grid;
  gap: 14px;
  padding: 30px;
}

.member-payment-content h2,
.member-payment-content p {
  margin: 0;
}

.member-payment-order,
.member-payment-amount {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #f7fafb;
}

.member-payment-order span,
.member-payment-amount span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.member-payment-order strong {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.member-payment-amount {
  border-color: rgba(199, 122, 36, 0.36);
  background: #fff8eb;
}

.member-payment-amount strong {
  color: var(--teal-dark);
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.member-payment-content .payment-countdown {
  color: #8d5718;
  font-variant-numeric: tabular-nums;
}

.member-payment-content .payment-long-press {
  color: var(--teal-dark);
  font-weight: 800;
}

.member-payment-qr {
  display: grid;
  justify-items: center;
  padding-top: 2px;
}

.admin-orders {
  display: grid;
  gap: 16px;
}

.admin-dashboard {
  display: grid;
  gap: 16px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-tab {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.admin-tab.is-active {
  background: var(--ink);
  color: white;
}

.admin-tab svg {
  width: 18px;
  height: 18px;
}

.admin-order-actions {
  align-items: end;
  flex-wrap: wrap;
  margin-top: 16px;
}

.admin-price-editor {
  display: grid;
  flex: 1 1 100%;
  grid-template-columns: minmax(190px, 280px) auto minmax(180px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(199, 122, 36, 0.32);
  background: #fff8eb;
}

.admin-price-editor > small {
  align-self: center;
  color: #715331;
  font-weight: 700;
}

.admin-fulfillment-records {
  display: grid;
  gap: 28px;
}

.admin-record-section {
  min-width: 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.admin-record-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-record-heading small,
.admin-record-heading h4 {
  display: block;
  margin: 0;
}

.admin-record-heading small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-record-heading h4 {
  font-size: 21px;
}

.record-state {
  color: #8d5718;
  font-size: 13px;
  font-weight: 850;
}

.record-state.is-complete {
  color: #23684a;
}

.admin-serial-records {
  display: grid;
  gap: 14px;
}

.admin-saved-serial,
.admin-saved-tracking {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(180px, 0.65fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
}

.admin-saved-serial > span,
.admin-saved-tracking > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.admin-saved-serial > strong,
.admin-saved-tracking > strong {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.admin-saved-serial > small {
  color: var(--muted);
  font-weight: 700;
}

.admin-record-save {
  margin-top: 14px;
}

.admin-sf-online-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #d9e1e6;
  background: #f6f8fa;
}

.admin-sf-online-order.is-ready {
  border-color: rgba(28, 91, 214, 0.28);
  background: #f3f7ff;
}

.admin-sf-online-order > div {
  display: grid;
  gap: 4px;
}

.admin-sf-online-order strong {
  color: var(--ink);
  font-size: 15px;
}

.admin-sf-online-order small {
  max-width: 700px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-sf-online-order button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.admin-tracking-editor {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-logistics-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.admin-logistics-step {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 5px;
  padding-top: 14px;
  border-top: 3px solid #d9e1e6;
}

.admin-logistics-step.is-done {
  border-color: var(--teal);
}

.admin-logistics-icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-top: -32px;
  place-items: center;
  border: 2px solid #d9e1e6;
  border-radius: 50%;
  background: white;
  color: var(--muted);
}

.admin-logistics-step.is-done .admin-logistics-icon {
  border-color: var(--teal);
  background: var(--teal-dark);
  color: white;
}

.admin-logistics-icon svg {
  width: 17px;
  height: 17px;
}

.admin-logistics-step strong,
.admin-logistics-step small {
  overflow-wrap: anywhere;
}

.admin-logistics-step small {
  color: var(--muted);
  line-height: 1.45;
}

.admin-logistics-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.admin-tracking-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.admin-tracking-head > div {
  display: grid;
  gap: 3px;
}

.admin-tracking-head small,
.admin-tracking-head span,
.tracking-config-note,
.tracking-empty-note {
  color: var(--muted);
}

.admin-field {
  flex: 1 1 180px;
}

.admin-serial-field {
  flex-basis: 260px;
}

.admin-serial-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
}

.admin-camera-btn {
  width: 46px;
  border: 1px solid var(--line);
  background: #edf6f5;
  color: var(--teal-dark);
}

.admin-camera-btn.is-scanning svg {
  animation: spin 0.9s linear infinite;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.admin-member-search {
  display: flex;
  width: min(100%, 320px);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-member-search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
}

.member-admin-list,
.serial-manager-list {
  display: grid;
  gap: 10px;
}

.admin-order-group,
.member-admin-group {
  display: grid;
  gap: 12px;
}

.admin-order-group + .admin-order-group,
.member-admin-group + .member-admin-group {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.admin-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-group-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
}

.admin-group-heading > span {
  min-width: 34px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e9f5f4;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.admin-order-group-list,
.member-admin-group-list {
  display: grid;
  gap: 12px;
}

.order-card.is-archived {
  background: #f7f8f9;
  box-shadow: none;
  opacity: 0.86;
}

.order-expiry-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #d18a22;
  background: #fff8eb;
  color: #744a0a;
  font-size: 13px;
  font-weight: 700;
}

.order-expiry-note.is-closed {
  border-color: #98a2b3;
  background: #eef1f4;
  color: #475467;
}

.member-admin-card,
.serial-manager-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(120px, 0.7fr));
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-admin-card {
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.65fr);
  align-items: start;
}

.member-account,
.member-summary {
  display: grid;
  gap: 4px;
}

.member-purchases {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.member-admin-editor {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.member-admin-editor summary {
  cursor: pointer;
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 800;
}

.member-admin-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 16px;
}

.member-metadata-form,
.member-coupon-admin,
.member-coupon-form,
.member-coupon-list {
  display: grid;
  gap: 12px;
}

.member-metadata-form h4,
.member-coupon-admin h4 {
  margin: 0;
  color: var(--ink);
}

.member-metadata-form textarea {
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}

.member-service-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.member-coupon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f7faf9;
}

.member-purchase-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, auto);
  gap: 18px;
  align-items: center;
  padding: 10px 12px;
  background: #f7faf9;
}

.member-purchase-row > div {
  display: grid;
  gap: 4px;
}

.member-purchase-row > div:last-child {
  justify-items: end;
}

.member-serial {
  color: var(--teal-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.member-admin-card strong,
.member-admin-card span,
.serial-manager-row strong,
.serial-manager-row span {
  display: block;
}

.member-admin-card small,
.serial-manager-row small {
  color: var(--muted);
}

.admin-serial-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(220px, 1fr) minmax(180px, 0.7fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid rgba(29, 124, 120, 0.24);
  border-radius: 8px;
  background: #f4fbfa;
}

.admin-serial-form [hidden] {
  display: none !important;
}

.admin-sale-source {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-sale-source legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 850;
}

.admin-sale-source > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-source-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 620px;
}

.admin-source-toggle label {
  position: relative;
  cursor: pointer;
}

.admin-source-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.admin-source-toggle span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.admin-source-toggle input:checked + span {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  color: white;
}

.admin-source-toggle input:focus-visible + span {
  outline: 3px solid rgba(29, 124, 120, 0.24);
  outline-offset: 2px;
}

.admin-direct-serial-field {
  grid-column: span 2;
}

.admin-serial-submit {
  min-height: 44px;
}

.admin-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-field small.is-error {
  color: #b42318;
}

.admin-field input.is-invalid {
  border-color: #d92d20;
  outline: 2px solid rgba(217, 45, 32, 0.12);
}

.admin-field input:disabled {
  color: var(--muted);
  background: #f2f5f7;
  cursor: not-allowed;
}

.admin-tab-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #c9362f;
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.admin-payment-claim {
  display: flex;
  margin-top: 14px;
  padding: 13px 14px;
  align-items: center;
  gap: 11px;
  border: 1px solid #e8cf9e;
  border-radius: 9px;
  background: #fff8e9;
  color: #704807;
}

.admin-payment-claim svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.admin-payment-claim div {
  display: grid;
  gap: 3px;
}

.admin-payment-claim small {
  color: #8b6b34;
}

.support-admin-layout {
  display: grid;
  min-height: 560px;
  overflow: hidden;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.55fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.support-conversation-list {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f7f9fa;
}

.support-conversation-item {
  position: relative;
  display: grid;
  width: 100%;
  padding: 16px;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.support-conversation-item:hover,
.support-conversation-item.is-active {
  background: white;
}

.support-conversation-item.is-active {
  box-shadow: inset 3px 0 0 var(--teal);
}

.support-conversation-item.has-unread::after {
  position: absolute;
  top: 17px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d33c35;
  content: "";
}

.support-conversation-item strong {
  padding-right: 18px;
  font-size: 14px;
}

.support-conversation-item span,
.support-conversation-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.support-conversation-item p {
  margin: 0;
  overflow: hidden;
  color: #45515f;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-conversation-detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.support-detail-head {
  display: flex;
  padding: 18px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.support-detail-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.support-detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.support-admin-messages {
  display: flex;
  min-height: 360px;
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  background: #f8fafb;
}

.support-admin-message {
  max-width: 76%;
  padding: 12px 14px;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 13px 13px 13px 4px;
  background: white;
}

.support-admin-message.is-admin {
  align-self: flex-end;
  border-color: var(--teal-dark);
  border-radius: 13px 13px 4px 13px;
  background: var(--teal-dark);
  color: white;
}

.support-admin-message small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.support-admin-message.is-admin small {
  color: rgba(255, 255, 255, 0.72);
}

.support-admin-message p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.support-reply-form {
  display: grid;
  padding: 16px 20px 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.support-reply-form textarea {
  min-height: 74px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
}

.support-reply-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29, 124, 120, 0.12);
}

.support-reply-form .primary-btn {
  align-self: end;
}

.admin-field select:disabled {
  color: var(--muted);
  background: #f2f5f7;
  cursor: not-allowed;
}

@media (max-width: 820px) {
  .portal-nav {
    display: none;
  }

  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    padding-bottom: 28px;
  }

  .profile-form {
    grid-template-columns: 1fr 1fr;
  }

  .admin-serial-form,
  .member-admin-card,
  .serial-manager-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-logistics-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 30px;
  }

  .admin-price-editor {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .admin-saved-serial,
  .admin-saved-tracking {
    grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr);
  }

  .admin-saved-serial > small {
    grid-column: 1 / -1;
  }

  .admin-price-editor > small {
    grid-column: 1 / -1;
  }

  .admin-direct-serial-field,
  .admin-serial-submit {
    grid-column: 1 / -1;
  }

  .member-purchase-row {
    grid-template-columns: 1fr;
  }

  .member-admin-editor-grid {
    grid-template-columns: 1fr;
  }

  .member-purchase-row > div:last-child {
    justify-items: start;
  }

  .support-admin-layout {
    grid-template-columns: minmax(210px, 0.65fr) minmax(0, 1.35fr);
  }
}

@media (max-width: 520px) {
  .order-serial-line {
    grid-template-columns: 1fr auto;
  }

  .order-serial-line span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .portal-main {
    width: min(100% - 28px, 1180px);
    padding-top: 38px;
  }

  .portal-account span,
  .brand small {
    display: none;
  }

  .auth-input-row,
  .member-summary,
  .profile-form {
    grid-template-columns: 1fr;
  }

  .auth-input-row .primary-btn {
    width: 100%;
  }

  .member-summary div {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .profile-wide {
    grid-column: auto;
  }

  .compact-heading,
  .profile-actions,
  .order-head {
    align-items: stretch;
    flex-direction: column;
  }

  .order-actions .text-btn {
    width: 100%;
  }

  .admin-tabs {
    grid-template-columns: 1fr;
  }

  .admin-source-toggle {
    grid-template-columns: 1fr;
  }

  .admin-serial-form,
  .member-admin-card,
  .serial-manager-row {
    grid-template-columns: 1fr;
  }

  .admin-logistics-timeline,
  .admin-price-editor {
    grid-template-columns: 1fr;
  }

  .admin-price-editor > small {
    grid-column: auto;
  }

  .admin-price-editor .secondary-btn {
    width: 100%;
  }

  .admin-record-heading {
    align-items: flex-start;
  }

  .admin-saved-serial,
  .admin-saved-tracking,
  .admin-sf-online-order,
  .admin-tracking-editor {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .admin-saved-serial > small {
    grid-column: auto;
  }

  .admin-record-save,
  .admin-sf-online-order .primary-btn,
  .admin-tracking-editor .primary-btn {
    width: 100%;
  }

  .admin-tracking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .member-payment-content {
    padding: 24px 18px 20px;
  }

  .member-payment-amount strong {
    font-size: 34px;
  }

  .admin-member-search {
    width: 100%;
  }

  .support-admin-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .support-conversation-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .support-admin-messages {
    min-height: 320px;
    padding: 16px;
  }

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

  .support-reply-form .primary-btn {
    width: 100%;
  }
}
