:root {
  color-scheme: light;
  --bg: #eef0e8;
  --surface: #f8f8f3;
  --surface-strong: #ffffff;
  --ink: #17211b;
  --muted: #657068;
  --line: #d9ddd4;
  --accent: #b64732;
  --accent-hover: #963825;
  --forest: #294b3b;
  --forest-deep: #183226;
  --forest-soft: #dce6dc;
  --sand: #e7deca;
  --warning: #9a642b;
  --warning-soft: #f7ecd7;
  --danger: #a33325;
  --danger-soft: #f7e2dd;
  --success: #286344;
  --success-soft: #deecdf;
  --blue: #315e72;
  --blue-soft: #dce8eb;
  --radius-card: 18px;
  --radius-control: 11px;
  --shadow: 0 18px 48px rgb(38 55 45 / 0.12);
  --shadow-soft: 0 10px 28px rgb(38 55 45 / 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  border-radius: var(--radius-control);
  background: var(--forest-deep);
  color: #fff;
  padding: 10px 14px;
  font-weight: 750;
}

.skip-link:focus {
  transform: translateY(0);
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-style: italic;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.brand-centered {
  margin-inline: auto;
  text-align: left;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 0 16px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: var(--forest);
  color: #fff;
}

.button-primary:hover {
  background: var(--forest-deep);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--forest);
  color: var(--forest);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.button-danger:hover {
  background: #81271d;
}

.button-compact {
  min-height: 38px;
  padding-inline: 13px;
  font-size: 13px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px;
  font-weight: 750;
}

.text-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.gate-state {
  display: grid;
  width: min(100% - 40px, 680px);
  min-height: 100dvh;
  align-content: center;
  justify-items: center;
  margin: 0 auto;
  padding-block: 60px;
  text-align: center;
}

.gate-state h1 {
  max-width: 15ch;
  margin: 26px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 7vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.gate-state > p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
}

.gate-state .eyebrow {
  margin-top: 52px;
  color: var(--danger);
}

.gate-state-error {
  width: min(100% - 40px, 860px);
}

.account-id-card {
  display: grid;
  width: min(100%, 620px);
  gap: 10px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  text-align: left;
}

.account-id-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.account-id-card > code {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
  user-select: all;
}

.account-id-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.loading-mark {
  width: 42px;
  height: 42px;
  margin-top: 58px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.admin-shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: 258px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 18px 18px;
}

.admin-sidebar > .brand {
  padding: 0 8px 26px;
}

.nav-label {
  margin: 4px 12px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-nav {
  display: grid;
  gap: 5px;
}

.admin-nav-item {
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: var(--forest-soft);
  color: var(--ink);
}

.nav-badge {
  min-width: 25px;
  border-radius: 99px;
  background: var(--surface-strong);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.sidebar-note {
  margin: auto 4px 20px;
  border: 1px solid color-mix(in srgb, var(--forest) 18%, transparent);
  border-radius: 14px;
  background: var(--forest-soft);
  padding: 15px;
}

.sidebar-note strong {
  color: var(--forest-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 600;
}

.sidebar-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-user {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 18px 8px 10px;
}

.admin-user strong,
.admin-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user strong {
  font-size: 13px;
}

.admin-user small {
  color: var(--muted);
  font-size: 11px;
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 2px;
}

.sidebar-links a {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.admin-main {
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: 10px clamp(20px, 4vw, 58px);
  backdrop-filter: blur(16px);
}

.admin-topbar strong {
  display: block;
  font-size: 16px;
}

.topbar-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-state {
  min-width: 100px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.global-status {
  width: min(calc(100% - 40px), 1380px);
  min-height: 0;
  margin: 14px auto -4px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.global-status:not(:empty) {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 14px;
}

.global-status[data-tone="success"] {
  border-color: color-mix(in srgb, var(--success) 28%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.global-status[data-tone="error"] {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.admin-panel {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 76px) clamp(20px, 4vw, 58px) 80px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.page-heading-compact {
  align-items: center;
}

.page-heading h1,
.support-hero h1 {
  max-width: 15ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 5vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.97;
}

.page-heading > div > p:last-child,
.support-hero > div > p:last-child {
  max-width: 64ch;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 42px 0 16px;
}

.section-heading h2,
.card-heading h2,
.workspace-heading h2,
.table-card-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.configuration-notice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 13px;
  border: 1px solid color-mix(in srgb, var(--blue) 25%, var(--line));
  border-radius: 15px;
  background: var(--blue-soft);
  padding: 16px 18px;
}

.configuration-notice[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--warning) 26%, var(--line));
  background: var(--warning-soft);
}

.configuration-notice[data-tone="success"] {
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
  background: var(--success-soft);
}

.notice-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--blue);
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 800;
}

.configuration-notice[data-tone="warning"] .notice-mark {
  color: var(--warning);
}

.configuration-notice[data-tone="success"] .notice-mark {
  color: var(--success);
}

.configuration-notice strong {
  display: block;
  margin-top: 2px;
}

.configuration-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.compact-notice {
  margin-bottom: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.metric-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.metric-card small {
  display: block;
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
}

.surface-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.surface-card {
  padding: clamp(18px, 2.5vw, 28px);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.card-heading,
.table-card-heading,
.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.card-heading {
  margin-bottom: 20px;
}

.compact-list {
  display: grid;
}

.compact-item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.compact-item:first-child {
  border-top: 0;
}

.compact-item strong,
.compact-item span {
  display: block;
}

.compact-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item span,
.compact-item time {
  color: var(--muted);
  font-size: 12px;
}

.compact-item > span:last-child,
.compact-item > time:last-child {
  text-align: right;
}

.empty-copy {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.compact-field,
.field {
  display: grid;
  gap: 7px;
}

.compact-field > span,
.field > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.field > span small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.compact-field select,
.field input,
.field select,
.field textarea,
.search-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-strong);
}

.compact-field select {
  min-width: 150px;
  min-height: 40px;
  padding: 0 34px 0 11px;
}

.field input,
.field select {
  min-height: 46px;
  padding: 0 13px;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.55;
}

.field > small {
  color: var(--muted);
  font-size: 11px;
}

.ticket-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, auto));
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.ticket-search-field {
  min-width: 0;
}

.ticket-workspace {
  display: grid;
  min-height: 650px;
  grid-template-columns: minmax(280px, 0.72fr) minmax(440px, 1.28fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.ticket-list-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.workspace-heading {
  min-height: 70px;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}

.workspace-heading span {
  color: var(--muted);
  font-size: 12px;
}

.ticket-list {
  display: grid;
  align-content: start;
  max-height: 780px;
  overflow-y: auto;
}

.ticket-page-controls {
  display: grid;
  justify-items: start;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 14px 20px 16px;
}

.ticket-page-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.notice-action {
  margin-top: 10px;
}

.ticket-list-item {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 17px 20px;
  text-align: left;
}

.ticket-list-item:hover,
.ticket-list-item.active {
  background: var(--forest-soft);
}

.ticket-item-top,
.ticket-item-bottom {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-item-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-list-item > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-item-bottom span,
.ticket-item-bottom time {
  color: var(--muted);
  font-size: 11px;
}

.thread-panel {
  min-width: 0;
  background: var(--surface-strong);
}

.thread-empty {
  display: grid;
  min-height: 650px;
  align-content: center;
  justify-items: center;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.thread-empty > span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest);
  font-size: 25px;
}

.thread-empty h2 {
  margin: 18px 0 7px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 500;
}

.thread-empty p {
  max-width: 42ch;
  margin: 0;
}

.thread-header {
  display: flex;
  min-height: 115px;
  align-items: start;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  padding: 22px clamp(18px, 3vw, 30px);
}

.thread-header h2 {
  margin: 8px 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.5vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.thread-header p,
.thread-reference {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.thread-reference {
  flex: 0 0 auto;
}

.thread-meta-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 99px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill[data-status="resolved"],
.status-pill[data-status="closed"],
.status-pill[data-status="succeeded"],
.status-pill[data-status="paid"],
.status-pill[data-status="active"] {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill[data-status="waiting-for-user"],
.status-pill[data-status="requires_action"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill[data-status="failed"],
.status-pill[data-status="canceled"],
.status-pill[data-status="refunded"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.message-thread {
  display: grid;
  gap: 16px;
  max-height: 520px;
  overflow-y: auto;
  padding: clamp(18px, 3vw, 30px);
}

.message-bubble {
  width: min(86%, 660px);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: var(--surface);
  padding: 14px 16px;
}

.message-bubble[data-role="admin"] {
  justify-self: end;
  border-color: color-mix(in srgb, var(--forest) 18%, var(--line));
  border-radius: 16px 16px 4px;
  background: var(--forest-soft);
}

.message-bubble-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message-bubble-header strong {
  font-size: 12px;
}

.message-bubble-header time {
  color: var(--muted);
  font-size: 10px;
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.thread-actions {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(18px, 3vw, 30px);
}

.reply-form {
  display: grid;
  gap: 12px;
}

.reply-form .button {
  justify-self: end;
}

.status-form {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.table-card {
  overflow: hidden;
}

.table-card-heading {
  padding: 20px 22px;
}

.table-card-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.table-card-heading > span,
.subtle-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.responsive-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

td strong,
td small {
  display: block;
}

td small {
  max-width: 34ch;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td .button {
  white-space: nowrap;
}

.table-empty {
  border-top: 1px solid var(--line);
  padding: 42px 20px;
  text-align: center;
}

.table-empty strong {
  display: block;
}

.table-empty p {
  margin: 6px 0 0;
  color: var(--muted);
}

.refund-history {
  margin-top: 20px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(420px, 1.18fr);
  align-items: start;
  gap: 20px;
}

.sticky-card {
  position: sticky;
  top: 90px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-strong);
  padding: 13px;
  cursor: pointer;
}

.check-field input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--forest);
}

.check-field strong,
.check-field small {
  display: block;
}

.check-field strong {
  font-size: 13px;
}

.check-field small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.check-field-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: var(--danger-soft);
}

.check-field-danger input {
  accent-color: var(--danger);
}

.discount-list {
  display: grid;
  gap: 12px;
}

.discount-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-strong);
  padding: 16px;
}

.discount-card-top,
.discount-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.discount-code {
  display: inline-flex;
  width: fit-content;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface-strong));
  color: var(--accent);
  padding: 5px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.discount-card h3 {
  margin: 13px 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 500;
}

.discount-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.discount-meta {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 13px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.discount-meta span {
  border-radius: 99px;
  background: var(--bg);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 10px;
}

.search-field {
  display: grid;
  min-width: min(340px, 100%);
  min-height: 46px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 0 12px;
}

.search-field > span:first-child {
  color: var(--muted);
  font-size: 20px;
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
}

.audit-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.audit-item:first-child {
  border-top: 0;
}

.audit-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 4px var(--forest-soft);
}

.audit-item strong,
.audit-item span {
  display: block;
}

.audit-item span,
.audit-item time {
  color: var(--muted);
  font-size: 11px;
}

.audit-item time {
  text-align: right;
}

.action-dialog {
  width: min(calc(100% - 28px), 650px);
  max-height: min(90dvh, 820px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 26px 80px rgb(15 25 19 / 0.28);
}

.action-dialog::backdrop {
  background: rgb(17 25 20 / 0.66);
  backdrop-filter: blur(4px);
}

.action-dialog form {
  display: grid;
  gap: 17px;
  padding: clamp(20px, 4vw, 30px);
}

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.ack-intro {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ack-summary {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.2fr);
}

.refund-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.refund-summary > span {
  min-width: 0;
  background: var(--surface-strong);
  padding: 12px;
}

.refund-summary small,
.refund-summary strong {
  display: block;
}

.refund-summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.refund-summary strong {
  overflow: hidden;
  margin-top: 4px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-status {
  min-height: 20px;
  margin: -4px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.dialog-status[data-tone="error"] {
  color: var(--danger);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.support-body {
  background:
    radial-gradient(circle at 8% 8%, rgb(255 255 255 / 0.7), transparent 27%),
    var(--bg);
}

.support-shell {
  min-height: 100dvh;
}

.support-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 14px clamp(20px, 5vw, 72px);
  backdrop-filter: blur(16px);
}

.support-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.support-user {
  color: var(--muted);
  font-size: 12px;
}

.support-main {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 72px) 90px;
}

.support-global-status {
  width: 100%;
}

.support-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: end;
  gap: clamp(28px, 7vw, 100px);
  padding: clamp(58px, 8vw, 112px) 0 44px;
}

.support-hero h1 {
  max-width: 13ch;
}

.support-promise {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--forest) 20%, var(--line));
  border-radius: var(--radius-card);
  background: var(--forest-soft);
  padding: 22px;
}

.support-promise > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--accent);
}

.support-promise strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 500;
}

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

.support-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(380px, 1.18fr);
  align-items: start;
  gap: 20px;
}

.support-create-card {
  position: sticky;
  top: 24px;
}

.support-tickets-card {
  min-height: 380px;
}

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

.own-ticket-button {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 15px;
  text-align: left;
}

.own-ticket-button:hover,
.own-ticket-button.active {
  border-color: color-mix(in srgb, var(--forest) 42%, var(--line));
  background: var(--forest-soft);
}

.own-ticket-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.own-ticket-button > span,
.own-ticket-button time {
  color: var(--muted);
  font-size: 11px;
}

.own-ticket-button .status-pill {
  justify-self: end;
}

.support-ticket-empty {
  display: grid;
  min-height: 250px;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.support-ticket-empty > span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest);
  font-size: 23px;
}

.support-ticket-empty strong {
  margin-top: 14px;
  color: var(--ink);
}

.support-ticket-empty p {
  max-width: 42ch;
  margin: 5px 0 0;
}

.support-thread-card {
  margin-top: 20px;
  padding: 0;
  overflow: hidden;
}

.support-message-thread {
  max-height: none;
}

.support-message-thread .message-bubble[data-role="admin"] {
  justify-self: start;
  border-color: var(--line);
  border-radius: 16px 16px 16px 4px;
  background: var(--surface);
}

.support-message-thread .message-bubble[data-role="user"] {
  justify-self: end;
  border-color: color-mix(in srgb, var(--forest) 18%, var(--line));
  border-radius: 16px 16px 4px;
  background: var(--forest-soft);
}

.support-reply-form {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
  padding: clamp(18px, 3vw, 30px);
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ticket-search-field {
    grid-column: 1 / -1;
  }

  .ticket-workspace {
    grid-template-columns: minmax(250px, 0.66fr) minmax(380px, 1.34fr);
  }

  .split-layout,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .sticky-card,
  .support-create-card {
    position: static;
  }
}

@media (max-width: 860px) {
  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: sticky;
    z-index: 35;
    top: 0;
    display: block;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    padding: 8px 10px;
    box-shadow: 0 8px 22px rgb(38 55 45 / 0.08);
    backdrop-filter: blur(16px);
  }

  .admin-sidebar > .brand {
    display: none;
  }

  .nav-label,
  .sidebar-note,
  .admin-user,
  .sidebar-links {
    display: none;
  }

  .admin-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 3px;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .admin-nav-item {
    display: inline-flex;
    width: auto;
    min-width: max-content;
    min-height: 39px;
    gap: 7px;
    padding: 8px 11px;
    scroll-snap-align: start;
  }

  .admin-topbar {
    top: 58px;
  }

  .page-heading,
  .support-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .page-heading {
    flex-direction: column;
  }

  .page-heading .button,
  .page-heading .compact-field,
  .page-heading .search-field {
    align-self: stretch;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .ticket-workspace {
    display: block;
  }

  .ticket-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .ticket-list {
    max-height: 360px;
  }

  .thread-empty {
    min-height: 320px;
  }

  .support-hero {
    display: grid;
  }
}

@media (max-width: 620px) {
  .admin-topbar {
    min-height: 60px;
    padding-inline: 16px;
  }

  .topbar-kicker,
  .sync-state {
    display: none;
  }

  .admin-panel {
    padding: 34px 16px 60px;
  }

  .page-heading {
    gap: 20px;
  }

  .page-heading h1,
  .support-hero h1 {
    font-size: clamp(2.55rem, 13vw, 4.2rem);
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .ticket-filter-bar {
    grid-template-columns: 1fr;
  }

  .ticket-search-field {
    grid-column: auto;
  }

  .metric-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 16px;
    padding: 16px;
  }

  .metric-card strong {
    grid-row: 1 / span 2;
    grid-column: 2;
    margin: 0;
    font-size: 2.2rem;
  }

  .metric-card small {
    min-height: 0;
    margin: 0;
  }

  .field-row,
  .refund-summary {
    grid-template-columns: 1fr;
  }

  .refund-summary {
    gap: 0;
  }

  .refund-summary > span + span {
    border-top: 1px solid var(--line);
  }

  .status-form {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-field select {
    width: 100%;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }

  .message-bubble {
    width: 94%;
  }

  .support-header {
    padding: 12px 16px;
  }

  .support-header .brand small,
  .support-user {
    display: none;
  }

  .support-header .button {
    min-height: 40px;
    padding-inline: 11px;
  }

  .support-main {
    padding: 0 16px 60px;
  }

  .support-hero {
    padding-top: 52px;
  }

  .support-promise {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 17px;
  }

  .support-promise > span {
    width: 36px;
    height: 36px;
  }

  .own-ticket-button {
    grid-template-columns: minmax(0, 1fr);
  }

  .own-ticket-button .status-pill {
    justify-self: start;
  }
}

@media (max-width: 460px) {
  .admin-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    padding-bottom: 0;
  }

  .admin-nav-item {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 4px;
    padding: 7px 6px;
    font-size: 11px;
  }

  .admin-nav-item > span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-topbar {
    top: 100px;
  }
}
