:root {
  color-scheme: dark;
  --codex-bg: #080712;
  --codex-panel: #121024;
  --codex-panel-2: #18142d;
  --codex-text: #f5f2ff;
  --codex-muted: #b4abc8;
  --codex-line: rgba(184, 159, 255, 0.22);
  --codex-purple: #8b5cf6;
  --codex-purple-2: #a855f7;
  --codex-danger: #fb7185;
  --codex-green: #34d399;
  --codex-shadow: 0 28px 90px rgba(4, 2, 14, 0.58);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.22), transparent 34rem),
    linear-gradient(135deg, #080712 0%, #11101f 48%, #070612 100%);
  color: var(--codex-text);
}

a {
  color: inherit;
}

.isHidden {
  display: none !important;
}

.codexShell,
.codexAdminShell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.codexAdminShell {
  width: min(1420px, calc(100% - 32px));
}

.codexHeader,
.codexAdminTopbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0;
}

.codexLogo {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.codexLogo span {
  color: var(--codex-purple-2);
}

.codexHeaderNav,
.codexAdminTopbarActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.codexHeaderNav a {
  color: var(--codex-muted);
  text-decoration: none;
  font-weight: 700;
  padding: 10px 12px;
}

.codexHeaderNav a:hover {
  color: var(--codex-text);
}

.codexHero {
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: 34px;
  align-items: center;
  padding: 36px 0 72px;
}

.codexHeroCopy h1,
.codexAdminTopbar h1,
.codexAdminCard h1,
.codexAdminCard h2,
.codexStatusPanel h2 {
  margin: 0;
  letter-spacing: 0;
}

.codexHeroCopy h1 {
  max-width: 760px;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 0.98;
}

.codexLead {
  max-width: 660px;
  margin: 24px 0 0;
  color: var(--codex-muted);
  font-size: 18px;
  line-height: 1.7;
}

.codexEyebrow {
  margin: 0 0 12px;
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.codexHeroActions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.codexButton {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid rgba(168, 85, 247, 0.72);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--codex-purple), var(--codex-purple-2));
  color: white;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(139, 92, 246, 0.28);
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease, box-shadow 220ms ease, color 220ms ease;
}

.codexButton.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--codex-text);
  border-color: var(--codex-line);
  box-shadow: none;
}

.codexButton:hover:not(:disabled),
.codexMiniButton:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(196, 181, 253, 0.88);
  background: linear-gradient(135deg, #9f7aea, #c084fc);
  box-shadow: 0 18px 38px rgba(139, 92, 246, 0.34);
}

.codexButton.secondary:hover:not(:disabled),
.codexMiniButton:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.2);
  color: var(--codex-text);
}

.codexButton:active:not(:disabled),
.codexMiniButton:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 10px 22px rgba(139, 92, 246, 0.22);
}

.codexButton:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.codexButton.isLoading,
.codexMiniButton.isLoading {
  position: relative;
  opacity: 0.82;
}

.codexButton.isLoading::after,
.codexMiniButton.isLoading::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: codexSpin 0.8s linear infinite;
}

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

.codexStatusPanel,
.codexAdminCard {
  border: 1px solid var(--codex-line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 20, 45, 0.95), rgba(15, 13, 30, 0.95));
  box-shadow: var(--codex-shadow);
}

.codexStatusPanel {
  padding: 28px;
}

.codexStatusPanel p,
.codexAdminCard p,
.codexAdminCard li {
  color: var(--codex-muted);
  line-height: 1.6;
}

.codexStatusPill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(168, 85, 247, 0.48);
  border-radius: 999px;
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.13);
  font-weight: 900;
  font-size: 12px;
}

.codexNetworkPill {
  min-width: 112px;
  line-height: 1;
}

.codexNetworkPills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.codexPricePreview {
  display: grid;
  gap: 4px;
  margin: 14px 0 4px;
  padding: 13px 12px 15px;
  border: 1px solid rgba(168, 85, 247, 0.32);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
}

.codexPricePreview span {
  color: var(--codex-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.codexPricePreview strong {
  color: var(--codex-text);
}

.codexStatusPanel dl,
.codexAdminDl {
  display: grid;
  gap: 12px;
  margin: 24px 0 0;
}

.codexAdminDl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.codexStatusPanel dl div,
.codexAdminDl div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.codexStatusPanel dt,
.codexAdminDl dt {
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.codexStatusPanel dd,
.codexAdminDl dd {
  margin: 0;
  color: var(--codex-text);
}

#codexPaymentRequirements {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

#codexPaymentRequirements li {
  padding: 8px 10px;
  border: 1px solid var(--codex-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--codex-muted);
  line-height: 1.25;
}

.codexForm,
.codexOrdersSearch {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  width: 100%;
}

.codexForm label {
  display: grid;
  gap: 8px;
  color: var(--codex-muted);
  font-weight: 800;
}

.codexForm input,
.codexOrdersSearch input,
.codexModalCard input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--codex-text);
  padding: 0 12px;
  font: inherit;
}

.codexNetworkChoice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
}

.codexNetworkChoice legend {
  grid-column: 1 / -1;
  color: var(--codex-muted);
  font-weight: 800;
}

.codexNetworkChoice label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 50px;
  padding: 12px 14px 12px 48px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--codex-text);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.codexNetworkChoice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.codexNetworkChoice span {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  line-height: 1.25;
}

.codexNetworkChoice span::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(196, 181, 253, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-50%);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.codexNetworkChoice span::after {
  content: "";
  position: absolute;
  left: -27px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--codex-purple), var(--codex-purple-2));
  transform: translateY(-50%) scale(0);
  transition: transform 180ms ease;
}

.codexNetworkChoice label:hover {
  border-color: rgba(196, 181, 253, 0.7);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 12px 28px rgba(88, 28, 135, 0.14);
}

.codexNetworkChoice label:focus-within {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18), 0 12px 28px rgba(88, 28, 135, 0.14);
}

.codexNetworkChoice input:focus-visible + span::before {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}

.codexNetworkChoice input:checked + span::before {
  border-color: rgba(196, 181, 253, 0.82);
  background: rgba(139, 92, 246, 0.18);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.12);
}

.codexNetworkChoice input:checked + span::after {
  transform: translateY(-50%) scale(1);
}

.codexPaymentBox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: start;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(168, 85, 247, 0.36);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.1);
}

.codexPaymentBox h3 {
  margin: 0 0 12px;
}

.codexPaymentInfo {
  min-width: 0;
}

.codexPaymentBox > p {
  grid-column: 1 / -1;
  margin: 0;
}

.codexQrBlock {
  display: grid;
  justify-items: center;
  gap: 12px;
  align-items: start;
  text-align: center;
  margin-top: 0;
  padding-top: 0;
}

.codexQrBlock img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.codexPayActions {
  display: none;
}

#codexPayTimer.isUrgent {
  color: var(--codex-danger);
}

.codexAddressRow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.codexAddressRow code,
#codexOrderPaymentAddress {
  overflow-wrap: anywhere;
  color: #ddd6fe;
}

.codexMiniButton {
  min-height: 32px;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--codex-text);
  padding: 0 10px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease, box-shadow 220ms ease, color 220ms ease;
}

.codexButton.isCopied,
.codexMiniButton.isCopied {
  background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
  border-color: rgba(196, 181, 253, 0.9) !important;
  color: #fff !important;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.26), 0 10px 24px rgba(139, 92, 246, 0.22) !important;
}

.codexSection {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 56px 0;
  border-top: 1px solid var(--codex-line);
}

.codexSection#my-orders {
  grid-template-columns: 1fr;
  align-items: start;
  justify-items: stretch;
}

.codexSection#my-orders > div,
.codexSection#my-orders > form,
.codexSection#my-orders > .codexOrdersList {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.codexSection h2 {
  margin: 0;
  font-size: 32px;
}

.codexSection p {
  color: var(--codex-muted);
  line-height: 1.7;
}

.codexOrdersList {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
  justify-items: stretch;
}

.codexOrderCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.codexOrderCard strong {
  display: block;
  margin-bottom: 8px;
}

.codexOrderCard > div:first-child,
.codexOrderCard dl {
  min-width: 0;
}

.codexOrderCard dl {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.codexOrderCard dt {
  color: var(--codex-muted);
  font-size: 12px;
  font-weight: 900;
}

.codexOrderCard dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.codexOrderCard .codexButton {
  align-self: start;
}

.codexOrderStatus {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.codexOrderStatus.isPaid,
.codexStatusPill.isSuccess {
  color: #bbf7d0;
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
}

.codexOrderStatus.isPending,
.codexStatusPill.isWarning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.codexOrderStatus.isFailed,
.codexStatusPill.isDanger {
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.15);
  border-color: rgba(251, 113, 133, 0.4);
}

.codexEmpty {
  padding: 18px;
  border: 1px dashed var(--codex-line);
  border-radius: 10px;
  color: var(--codex-muted);
}

.codexModal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 2, 14, 0.74);
}

.codexModal[hidden],
.codexModal.isHidden {
  display: none !important;
}

.codexModalCard {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--codex-line);
  border-radius: 12px;
  background: var(--codex-panel);
  box-shadow: var(--codex-shadow);
}

.codexModalCard h2 {
  margin: 0;
}

.codexModalActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.codexPayActions {
  display: none;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.codexOrderPanel {
  margin: 28px 0 64px;
}

.codexOrderPanel h1 {
  margin: 12px 0 0;
  font-size: clamp(32px, 6vw, 64px);
}

.codexOrderWorkspace {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.codexSlots {
  display: grid;
  gap: 10px;
  max-height: 396px;
  overflow: auto;
  padding: 4px 4px 4px 0;
}

.codexSlot {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--codex-text);
  padding: 13px 12px 15px;
  text-align: left;
  cursor: pointer;
  align-content: start;
  position: relative;
  z-index: 0;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.codexSlot:hover:not(:disabled),
.codexSlot.isActive {
  transform: translateY(-1px);
  border-color: rgba(168, 85, 247, 0.8);
  background: rgba(139, 92, 246, 0.16);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.14), 0 12px 28px rgba(88, 28, 135, 0.18);
  z-index: 2;
}

.codexSlot.isDone {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.12);
}

.codexSlot small {
  color: var(--codex-muted);
}

.codexSlot span,
.codexSlot small {
  line-height: 1.18;
}

.codexActivation {
  display: grid;
  gap: 16px;
}

.codexNumberBox,
.codexStatusGrid > div {
  padding: 18px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.codexNumberHeader,
.codexSmsCodeRow,
.codexActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.codexNumberHeader {
  justify-content: space-between;
}

.codexSmallLabel {
  color: var(--codex-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.codexPhoneNumber {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 10px 0 14px;
  font-size: clamp(28px, 4vw, 44px);
}

.codexPhoneNumber .phonePrefix {
  color: var(--codex-purple);
}

.codexPhoneNumber .phoneRest {
  color: var(--codex-text);
  overflow-wrap: anywhere;
}

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

.codexStatusGrid strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.codexActions p {
  width: 100%;
  margin: 0;
  color: var(--codex-muted);
}

.codexAdminShell {
  padding-bottom: 48px;
}

.codexAdminLogin {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.codexAdminCard {
  padding: 24px;
}

.codexAdminLogin .codexAdminCard {
  width: min(420px, 100%);
}

.codexAdminCard label {
  display: grid;
  gap: 8px;
  margin: 20px 0 14px;
  color: var(--codex-muted);
  font-weight: 800;
}

.codexAdminCard input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--codex-text);
  padding: 0 12px;
  font: inherit;
}

.codexAdminError {
  min-height: 22px;
  color: var(--codex-danger) !important;
}

.codexAdminError.isSuccess {
  min-height: 0;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(196, 181, 253, 0.36);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(168, 85, 247, 0.14));
  color: #ede9fe !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 28px rgba(88, 28, 135, 0.18);
}

.codexAdminGrid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.codexAdminGrid > .codexAdminCard {
  min-width: 0;
}

.codexAdminGrid > .codexAdminCard:nth-child(1) {
  grid-column: span 7;
}

.codexAdminGrid > .codexAdminCard:nth-child(2) {
  grid-column: span 5;
}

.codexAdminGrid > .codexAdminCard:nth-child(3) {
  grid-column: span 4;
}

.codexAdminGrid > .codexAdminCard:nth-child(4) {
  grid-column: span 8;
}

#codexPaymentSummary.isReady {
  color: var(--codex-green);
}

.codexVisitorStats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.codexVisitorStats div,
.codexVisitorRow {
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.codexVisitorStats div {
  padding: 12px;
}

.codexVisitorStats span {
  display: block;
  color: var(--codex-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.codexVisitorStats strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.codexVisitorsList {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

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

.codexVisitorRow b {
  font-size: 24px;
  line-height: 1;
}

.codexVisitorRow strong,
.codexVisitorRow span,
.codexVisitorRow small {
  display: block;
  overflow-wrap: anywhere;
}

.codexVisitorRow span,
.codexVisitorRow small {
  color: var(--codex-muted);
}

.codexToggleList {
  display: grid;
  gap: 10px;
}

.codexToggle,
.codexAdminChatItem {
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.codexToggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 60px;
  padding: 14px 68px 14px 14px;
  color: var(--codex-text);
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.codexToggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.codexToggle span {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  line-height: 1.35;
  padding-right: 54px;
}

.codexToggle span::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 44px;
  height: 24px;
  border: 1px solid rgba(196, 181, 253, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-50%);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.codexToggle span::after {
  content: "";
  position: absolute;
  right: 19px;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f8f6ff;
  transform: translateY(-50%);
  transition: transform 180ms ease, background 180ms ease;
}

.codexToggle:hover {
  border-color: rgba(196, 181, 253, 0.7);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 12px 28px rgba(88, 28, 135, 0.14);
}

.codexToggle:focus-within {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18), 0 12px 28px rgba(88, 28, 135, 0.14);
}

.codexToggle input:focus-visible + span::before {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}

.codexToggle input:checked + span::before {
  border-color: rgba(168, 85, 247, 0.7);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(168, 85, 247, 0.58));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.codexToggle input:checked + span::after {
  transform: translate(20px, -50%);
  background: #fff;
}

.codexAdminChats {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.codexAdminChats > .codexAdminCard {
  min-width: 0;
}

.codexAdminChats > .codexAdminCard:nth-child(1) {
  grid-column: span 3;
}

.codexAdminChats > .codexAdminCard:nth-child(2) {
  grid-column: span 3;
}

.codexAdminChats > .codexAdminCard:nth-child(3) {
  grid-column: span 6;
}

.codexAdminChatList,
.codexAdminMessages,
.codexChatMessages {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.codexAdminChatList {
  max-height: 520px;
}

.codexAdminChatItem {
  position: relative;
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px 42px 12px 12px;
  color: var(--codex-text);
  text-align: left;
  cursor: pointer;
}

.codexAdminChatItem.isActive {
  border-color: rgba(168, 85, 247, 0.8);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.14);
}

.codexAdminChatItem span,
.codexAdminChatItem small {
  color: var(--codex-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codexAdminChatItem b,
#codexChatUnread {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--codex-danger);
  color: #fff;
  font-size: 12px;
}

.codexAdminChatItem b {
  position: absolute;
  top: 12px;
  right: 12px;
}

.codexAdminMessages {
  min-height: 320px;
  max-height: 560px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.codexAdminMessage,
.codexChatMessage {
  display: grid;
  gap: 7px;
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--codex-line);
  background: rgba(255, 255, 255, 0.06);
}

.codexAdminMessage.isAdmin,
.codexChatMessage.isAdmin {
  justify-self: end;
  background: rgba(139, 92, 246, 0.22);
}

.codexAdminMessage.isCustomer,
.codexChatMessage.isCustomer {
  justify-self: start;
}

.codexAdminMessage p,
.codexChatMessage p {
  margin: 0;
  color: var(--codex-text);
  white-space: pre-wrap;
}

.codexAdminMessage small {
  color: var(--codex-muted);
}

.codexAdminMessage img,
.codexChatMessage img {
  max-width: min(260px, 100%);
  max-height: 220px;
  border-radius: 8px;
  cursor: zoom-in;
}

.codexAdminMessageForm,
.codexAdminChatStart,
.codexChatForm {
  display: grid;
  gap: 10px;
}

.codexAdminCard textarea,
.codexChatForm textarea {
  width: 100%;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--codex-text);
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

.codexChat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
}

.codexChatButton {
  position: relative;
  min-height: 48px;
  border: 1px solid rgba(168, 85, 247, 0.72);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--codex-purple), var(--codex-purple-2));
  color: #fff;
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(139, 92, 246, 0.28);
}

#codexChatUnread {
  position: absolute;
  top: -7px;
  right: -7px;
}

.codexChatPanel {
  position: absolute;
  right: 0;
  bottom: 60px;
  width: min(380px, calc(100vw - 36px));
  border: 1px solid var(--codex-line);
  border-radius: 12px;
  background: var(--codex-panel);
  box-shadow: var(--codex-shadow);
  overflow: hidden;
}

.codexChatPanel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--codex-line);
}

.codexChatPanel header div {
  display: grid;
  gap: 2px;
}

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

.codexChatPanel header button,
.codexImageModal button {
  border: 0;
  background: transparent;
  color: var(--codex-text);
  font-size: 22px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.codexChatPanel header button:hover,
.codexImageModal button:hover {
  transform: translateY(-1px);
  color: #fff;
}

.codexChatMessages {
  height: 320px;
  align-content: start;
  padding: 12px;
}

.codexChatForm {
  padding: 12px;
  border-top: 1px solid var(--codex-line);
}

.codexImageModal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 2, 14, 0.82);
}

.codexImageModal img {
  max-width: min(980px, 94vw);
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: var(--codex-shadow);
}

.codexImageModal button {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(196, 181, 253, 0.3);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.18);
}

.codexImageModal button:hover {
  border-color: rgba(196, 181, 253, 0.88);
  background: rgba(139, 92, 246, 0.3);
  box-shadow: 0 10px 24px rgba(88, 28, 135, 0.24);
}

.codexSellerChat {
  --k-line: var(--codex-line);
  --k-heading: var(--codex-text);
  --k-text: var(--codex-text);
  --k-faint: var(--codex-muted);
  --k-secondary: rgba(255, 255, 255, 0.06);
  --k-green: var(--codex-purple);
  --k-green-text: #ddd6fe;
  --k-button-text: #fff;
  --k-danger: var(--codex-danger);
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9990;
  font-family: inherit;
}

.codexSellerChat .sellerChatButton {
  min-width: 148px;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.codexSellerChat.isOpen .sellerChatButton {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  visibility: hidden;
}

.codexSellerChat .sellerChatPanel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(440px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(18, 16, 36, 0.98);
  box-shadow: var(--codex-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.98);
  transform-origin: right bottom;
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
  visibility: hidden;
}

.codexSellerChat.isOpen .sellerChatPanel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.codexSellerChat .sellerChatPanel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--codex-line);
  background: #100d20;
}

.codexSellerChat .sellerChatPanel header strong {
  display: block;
  color: var(--codex-text);
  font-size: 18px;
}

.codexSellerChat .sellerChatPanel header span {
  display: block;
  margin-top: 2px;
  color: var(--codex-muted);
  font-size: 12px;
  line-height: 1.35;
}

.codexSellerChat .sellerChatClose,
.sellerChatImageViewerClose {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--codex-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--codex-text);
  box-shadow: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.codexSellerChat .sellerChatClose:hover,
.sellerChatImageViewerClose:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 181, 253, 0.88);
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
  box-shadow: 0 10px 24px rgba(88, 28, 135, 0.22);
}

.codexSellerChat .sellerChatClose:active,
.sellerChatImageViewerClose:active {
  transform: translateY(0) scale(0.985);
}

.codexSellerChat .sellerChatMessages {
  overflow: auto;
  padding: 14px 14px 6px;
  background: #0c0a18;
}

.codexSellerChat .sellerChatTyping {
  min-height: 20px;
  padding: 0 14px 8px;
  background: #0c0a18;
  color: #ddd6fe;
  font-size: 13px;
  line-height: 20px;
}

.codexSellerChat .sellerChatForm {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px 16px;
  border-top: 1px solid var(--codex-line);
  background: #100d20;
}

.codexSellerChat .sellerChatForm textarea {
  height: 46px;
  min-height: 46px;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--codex-text);
  padding: 11px 12px;
  font: inherit;
  resize: none;
}

.codexSellerChat .sellerChatAttach {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--codex-text);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.codexSellerChat .sellerChatAttach:hover,
.codexSellerChat .sellerChatAttach:focus-within {
  transform: translateY(-1px);
  border-color: rgba(196, 181, 253, 0.88);
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
  box-shadow: 0 10px 24px rgba(88, 28, 135, 0.22);
}

.codexSellerChat .sellerChatAttach:active {
  transform: translateY(0) scale(0.985);
}

.codexSellerChat .sellerChatAttach input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.codexSellerChat .sellerChatFile {
  min-height: 0;
  padding: 0 12px 10px;
  background: #100d20;
  color: #ddd6fe;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.codexSellerChat .sellerChatFile:empty {
  display: none;
}

.codexSellerChat .sellerChatMessage {
  display: grid;
  gap: 6px;
  max-width: 82%;
  width: fit-content;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--codex-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.codexSellerChat .sellerChatMessage.isMine {
  margin-left: auto;
  background: rgba(139, 92, 246, 0.25);
}

.codexSellerChat .sellerChatMessage p {
  margin: 0;
  color: var(--codex-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.codexSellerChat .sellerChatMessage a {
  color: #c4b5fd;
}

.codexSellerChat .sellerChatMessage time {
  justify-self: end;
  color: var(--codex-muted);
  font-size: 11px;
}

.codexSellerChat .sellerChatMessage img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 280px;
  border-radius: 7px;
  object-fit: contain;
  cursor: zoom-in;
}

.sellerChatImageViewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 2, 14, 0.82);
}

.sellerChatImageViewer img {
  max-width: min(980px, 94vw);
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: var(--codex-shadow);
}

.sellerChatImageViewerClose {
  position: fixed;
  top: 18px;
  right: 22px;
}

@media (max-width: 820px) {
  .codexHeader,
  .codexAdminTopbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .codexHero,
  .codexAdminGrid,
  .codexAdminChats,
  .codexSection,
  .codexOrderWorkspace,
  .codexStatusGrid,
  .codexAdminDl,
  .codexNetworkChoice {
    grid-template-columns: 1fr;
  }

  .codexAdminGrid > .codexAdminCard,
  .codexAdminChats > .codexAdminCard {
    grid-column: 1 / -1;
  }

  .codexHero {
    min-height: auto;
  }

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

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

  .codexQrBlock {
    justify-items: start;
    text-align: left;
  }

  .codexOrderCard dl {
    grid-template-columns: 1fr;
  }
}
