:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: rgba(20, 20, 20, 0.78);
  --panel-strong: rgba(35, 9, 9, 0.86);
  --text: #f7f2f0;
  --muted: #b9aba7;
  --red: #ef2415;
  --red-dark: #8d100b;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: rgba(239, 36, 21, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 18%, rgba(239, 36, 21, 0.23), transparent 26rem),
    linear-gradient(145deg, #050505 0%, #120707 54%, #050505 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

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

button {
  border: 0;
}

.shell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  width: min(100%, 460px);
  min-height: 100%;
  margin: 0 auto;
  padding: 24px 18px;
  align-content: center;
}

.screen.is-active {
  display: grid;
  animation: rise 220ms ease-out both;
}

.brand {
  display: grid;
  gap: 24px;
  justify-items: center;
  margin-bottom: 44px;
  text-align: center;
}

.logo-wrap {
  position: relative;
  width: min(58vw, 230px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 22px 48px rgba(239, 36, 21, 0.24));
}

.logo {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fallback-logo {
  display: none;
  z-index: 0;
}

#brandLogo {
  z-index: 1;
}

.brand-text {
  display: grid;
  gap: 8px;
}

.eyebrow {
  color: #ff5a4e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 12vw, 44px);
  line-height: 0.98;
  max-width: 10ch;
  text-wrap: balance;
}

h2 {
  font-size: 30px;
  line-height: 1.05;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #ff3a2e 0%, var(--red) 47%, #a7140d 100%);
  box-shadow: 0 18px 42px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  text-transform: uppercase;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.dialog-entry {
  margin-top: 10px;
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.48;
  box-shadow: none;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-fab {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 18px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  color: white;
  background: rgba(239, 36, 21, 0.2);
  border: 1px solid rgba(255, 90, 78, 0.5);
  box-shadow: 0 12px 34px rgba(239, 36, 21, 0.18);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  z-index: 3;
}

.admin-fab[hidden] {
  display: none;
}

.pulse {
  animation: pulse 1.9s ease-in-out infinite;
}

.topline {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  align-items: center;
  align-self: start;
  margin-top: max(6px, env(safe-area-inset-top));
}

.admin-topline {
  grid-template-columns: 46px 1fr 46px;
  width: 100%;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  cursor: pointer;
}

.form {
  display: grid;
  gap: 16px;
  align-self: center;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), rgba(5, 5, 5, 0.76));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.field select {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(45, 11, 10, 0.96), rgba(10, 6, 6, 0.98));
  cursor: pointer;
}

.field select option {
  color: #fff4f1;
  background: #170807;
}

.field select option:checked,
.field select option:hover {
  color: white;
  background: #ef2415;
}

.field textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(255, 70, 56, 0.9);
  box-shadow: 0 0 0 3px rgba(239, 36, 21, 0.16);
}

.notice,
.status,
.done-copy,
.safe-copy,
.code-notice {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.code-notice {
  color: #ffaca6;
  font-weight: 600;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: rgba(239, 36, 21, 0.12);
  border: 1px solid rgba(239, 36, 21, 0.3);
}

.status {
  min-height: 20px;
  color: #ff8b83;
  text-align: center;
}

#doneScreen {
  justify-items: center;
  text-align: center;
  gap: 14px;
}

.done-mark {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(180deg, #ff3a2e, #9b120d);
  box-shadow: 0 18px 48px var(--shadow);
  font-size: 42px;
  font-weight: 900;
}

.done-copy,
.safe-copy {
  max-width: 31ch;
}

.done-title {
  max-width: 18ch;
  font-size: 26px;
  line-height: 1.08;
  text-wrap: balance;
}

.safe-copy {
  color: #ffaca6;
}

.admin-screen {
  align-content: start;
  gap: 18px;
  overflow-y: auto;
}

.request-list {
  display: grid;
  gap: 10px;
  width: 100%;
  align-self: start;
}

.request-card,
.empty-state,
.selected-request,
.reply-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), rgba(5, 5, 5, 0.82));
}

.request-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.request-main {
  font-weight: 900;
}

.request-meta,
.reply-date {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.request-badge {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  color: #ffd6d2;
  background: rgba(239, 36, 21, 0.18);
  border: 1px solid rgba(239, 36, 21, 0.42);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.request-badge.is-answered {
  color: #d8fff1;
  background: rgba(28, 170, 118, 0.16);
  border-color: rgba(28, 170, 118, 0.42);
}

.request-badge.is-completed {
  color: #d6e8ff;
  background: rgba(28, 118, 170, 0.16);
  border-color: rgba(28, 118, 170, 0.42);
}

.request-badge.is-user-reply {
  color: #fff1cf;
  background: rgba(198, 144, 38, 0.18);
  border-color: rgba(198, 144, 38, 0.48);
}

.request-badge.is-closed {
  color: #d9d9d9;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.reply-dialog {
  width: min(calc(100% - 28px), 460px);
  margin: auto;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.reply-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.dialog-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(31, 13, 13, 0.96), rgba(5, 5, 5, 0.96));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.dialog-head {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 12px;
  align-items: start;
}

.selected-request {
  padding: 12px;
  color: #ffd6d2;
  font-size: 13px;
  font-weight: 800;
  white-space: pre-wrap;
}

.reply-history {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.reply-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.reply-item.is-admin {
  border-color: rgba(239, 36, 21, 0.42);
  background: linear-gradient(180deg, rgba(72, 16, 13, 0.84), rgba(24, 9, 9, 0.86));
}

.reply-item.is-user {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(36, 36, 36, 0.84), rgba(10, 10, 10, 0.86));
}

.reply-item p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.user-dialog-screen {
  align-content: start;
  gap: 14px;
  overflow-y: auto;
}

.user-message-list {
  max-height: min(38vh, 280px);
}

.dialog-form {
  align-self: start;
  padding: 16px;
}

.ticket-status-button {
  min-height: 46px;
  font-size: 13px;
  text-transform: none;
}

.delete-ticket-button {
  min-height: 46px;
  color: #ffd6d2;
  background: rgba(239, 36, 21, 0.14);
  border-color: rgba(239, 36, 21, 0.42);
  font-size: 13px;
  text-transform: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 18px 42px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  }

  50% {
    transform: scale(1.025);
    box-shadow: 0 26px 62px rgba(239, 36, 21, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  }
}

@media (max-height: 620px) {
  .brand {
    gap: 16px;
    margin-bottom: 24px;
  }

  .logo-wrap {
    width: min(42vw, 160px);
  }

  h1 {
    font-size: 30px;
  }
}
