:root {
  color-scheme: dark;
  --bg: #090416;
  --panel: #15102a;
  --panel-2: #1c1733;
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.18);
  --text: #f7f2ff;
  --muted: #b3a7c8;
  --violet: #9d4cff;
  --violet-2: #6d35d7;
  --emerald: #2ee56f;
  --cyan: #27c9ff;
  --amber: #ffb12e;
  --danger: #ff4d6d;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.42);
  --app-titlebar-total: 52px;
  --app-titlebar-safe-top: 0px;
  --app-titlebar-row-height: 52px;
  --bottom-nav-height: 68px;
  --app-safe-top: max(
    16px,
    var(--tg-js-content-safe-area-top, 0px),
    var(--tg-content-safe-area-inset-top, 0px),
    var(--tg-js-safe-area-top, 0px),
    var(--tg-safe-area-inset-top, 0px),
    env(safe-area-inset-top)
  );
  --app-safe-bottom: max(
    8px,
    var(--tg-js-content-safe-area-bottom, 0px),
    var(--tg-content-safe-area-inset-bottom, 0px),
    var(--tg-js-safe-area-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px),
    env(safe-area-inset-bottom)
  );
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 8%, rgba(157, 76, 255, 0.22), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(39, 201, 255, 0.11), transparent 26%),
    linear-gradient(180deg, #070210 0%, #110920 42%, #070611 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 14px calc(var(--bottom-nav-height) + 12px);
}

.app-titlebar {
  display: grid;
  place-items: center;
  height: var(--app-titlebar-total);
  min-height: var(--app-titlebar-total);
  padding-top: var(--app-titlebar-safe-top);
}

.app-titlebar strong {
  display: grid;
  place-items: center;
  height: var(--app-titlebar-row-height);
  max-width: 210px;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-panel,
.smart-search,
.offer-card,
.promo,
.empty,
.period-panel,
.admin-panel,
.admin-card {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.amount-panel {
  margin-top: 0;
  padding: 14px;
}

.smart-search {
  margin-top: 10px;
  padding: 12px;
}

.smart-search input {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font: inherit;
  outline: none;
}

.smart-search input::placeholder {
  color: rgba(229, 220, 255, 0.48);
}

.smart-search input:focus {
  border-color: rgba(172, 84, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(172, 84, 255, 0.16);
}

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

.amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}

.amount-row strong {
  font-size: 25px;
  line-height: 1.2;
}

.amount-step {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.range-wrap {
  position: relative;
  margin: 10px 0 12px;
}

.range-wrap input {
  width: 100%;
  accent-color: var(--violet);
}

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

.chip {
  min-height: 38px;
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.chip.is-active {
  background: linear-gradient(180deg, var(--violet), var(--violet-2));
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.section-head button {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cf82ff;
  background: transparent;
}

.filter-button {
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06) !important;
}

.all-button {
  min-width: 48px;
  min-height: 34px;
  justify-content: center;
  border-radius: 8px;
  padding: 0 12px;
  color: #cf82ff !important;
  background: rgba(255, 255, 255, 0.06) !important;
  font-weight: 750;
}

.filter-button img {
  display: block;
  width: 25px;
  height: 25px;
  object-fit: contain;
}

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

.offers-grid > .offer-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - 10px) / 2);
}

.offer-card {
  position: relative;
  display: flex;
  min-height: 244px;
  flex-direction: column;
  padding: 13px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(157, 76, 255, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.066), rgba(255, 255, 255, 0.022));
}

.admin-offer-card {
  position: relative;
  display: flex;
  min-height: 288px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 13px;
  background:
    radial-gradient(circle at 18% 0%, rgba(157, 76, 255, 0.13), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.066), rgba(255, 255, 255, 0.022));
  box-shadow: var(--shadow);
}

.offer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.offer-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
}

.approval {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 48px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 7px;
  color: #ffe2fb;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
}

.offer-card h3 {
  margin: 11px 0 3px;
  padding-right: 36px;
  font-size: 15px;
  line-height: 1.17;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.admin-offer-card h3 {
  margin: 11px 0 3px;
  padding-right: 36px;
  font-size: 15px;
  line-height: 1.17;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.offer-card p {
  margin: 0;
  padding-right: 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.offer-card p + p {
  -webkit-line-clamp: 2;
}

.admin-offer-card p {
  margin: 0;
  padding-right: 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.28;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.admin-offer-card p + p {
  -webkit-line-clamp: 2;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
  margin-bottom: auto;
  padding-right: 30px;
}

.tag {
  border-radius: 6px;
  padding: 4px 6px;
  color: #d7c9ec;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.tag.is-good {
  color: #ddffe9;
}

.tag.is-bad {
  color: #ffd5df;
  background: rgba(255, 72, 110, 0.15);
}

.rate {
  align-self: flex-end;
  text-align: right;
  margin-top: 12px;
  margin-bottom: 7px;
  font-size: 28px;
  font-weight: 850;
  line-height: 0.95;
}

.rate small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.apply-button,
.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 750;
}

.apply-button {
  align-self: end;
  width: 100%;
  background: linear-gradient(180deg, #35ee7e, #159447);
  color: #06150b;
}

.favorite-button {
  position: absolute;
  top: 74px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.favorite-button img {
  display: block;
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.promo {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 18px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(157, 76, 255, 0.52), rgba(28, 23, 51, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.gift {
  display: grid;
  place-items: center;
  width: 64px;
  height: 50px;
  border-radius: 8px;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.1);
}

.promo strong {
  display: block;
  font-size: 15px;
}

.promo span {
  color: #dfd1ff;
  font-size: 12px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(90vw, 360px);
  height: 58px;
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(12, 8, 22, 0.88);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-rows: 28px 14px;
  gap: 2px;
  place-items: center;
  justify-items: center;
  align-content: center;
  width: 100%;
  text-align: center;
  min-width: 0;
  min-height: 44px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.nav-item--home {
  justify-self: center;
  width: 100%;
}

.nav-mask-icon,
.nav-home-icon {
  display: block;
  width: 28px;
  height: 28px;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.nav-search-icon {
  mask-image: url("/assets/search-icon.png");
  -webkit-mask-image: url("/assets/search-icon.png");
}

.nav-home-icon {
  mask-image: url("/assets/home-icon.png");
  -webkit-mask-image: url("/assets/home-icon.png");
}

.nav-heart-icon {
  mask-image: url("/assets/heart-icon.png");
  -webkit-mask-image: url("/assets/heart-icon.png");
}

.nav-item span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 24px;
  line-height: 28px;
}

.nav-item.is-active {
  color: #bd70ff;
  background: rgba(189, 112, 255, 0.12);
}

.nav-item.is-active::before {
  content: none;
}

.nav-item > * {
  position: relative;
  z-index: 1;
}

@media (min-width: 681px) {
  .bottom-nav {
    bottom: 14px;
    width: 330px;
    height: 56px;
  }

  .nav-item {
    min-height: 44px;
  }
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 50;
  width: min(92%, 420px);
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--text);
  background: #171225;
  box-shadow: var(--shadow);
}

.state-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.state-screen__box {
  max-width: 360px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.05);
}

.state-screen h1 {
  margin: 0 0 8px;
  font-size: 21px;
}

.state-screen p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 0 14px calc(104px + var(--app-safe-bottom));
}

.admin-head {
  position: relative;
  display: grid;
  min-height: calc(var(--app-titlebar-total) + 42px);
  place-items: center;
  padding-top: var(--app-titlebar-safe-top);
  margin-bottom: 14px;
  text-align: center;
}

.admin-head__title {
  display: grid;
  grid-template-rows: var(--app-titlebar-row-height) 34px;
  row-gap: 6px;
  place-items: center;
  min-height: calc(var(--app-titlebar-row-height) + 40px);
}

.admin-head h1 {
  display: grid;
  place-items: center;
  height: var(--app-titlebar-row-height);
  margin: 0;
  max-width: 170px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.admin-refresh {
  min-width: 112px;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}

.admin-tabs {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(90vw, 380px);
  height: 62px;
  gap: 0;
  margin: 0;
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(12, 8, 22, 0.9);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.admin-tabs button {
  display: grid;
  grid-template-rows: 28px 14px;
  gap: 2px;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.admin-tabs button.is-active {
  color: #bd70ff;
  background: rgba(189, 112, 255, 0.12);
}

.admin-tab-icon {
  display: block;
  width: 27px;
  height: 27px;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.admin-tab-icon--stats {
  mask-image: url("/assets/admin-stats-icon.png");
  -webkit-mask-image: url("/assets/admin-stats-icon.png");
}

.admin-tab-icon--offers {
  mask-image: url("/assets/admin-offers-icon.png");
  -webkit-mask-image: url("/assets/admin-offers-icon.png");
}

.admin-tab-icon--admins {
  mask-image: url("/assets/admin-admins-icon.png");
  -webkit-mask-image: url("/assets/admin-admins-icon.png");
}

.period-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px;
  background:
    radial-gradient(circle at 18% 0%, rgba(46, 229, 111, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.02));
}

.period-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.period-panel__head strong {
  color: #36f293;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.period-panel__head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.period-panel__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 14px;
  align-items: end;
}

.period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.period-presets button {
  min-height: 42px;
  border: 1px solid rgba(46, 229, 111, 0.18);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 750;
}

.period-presets button.is-active {
  border-color: transparent;
  color: #04140b;
  background: linear-gradient(180deg, #54ffae, #2ee56f);
}

.period-custom {
  display: grid;
  grid-template-columns: 1fr 1fr 120px;
  gap: 8px;
  align-items: end;
}

.period-custom label {
  display: grid;
  gap: 6px;
}

.period-custom label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.period-custom input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(46, 229, 111, 0.15);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.period-custom input:focus {
  border-color: rgba(46, 229, 111, 0.64);
  box-shadow: 0 0 0 3px rgba(46, 229, 111, 0.13);
}

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

.admin-card {
  padding: 14px;
}

.admin-card small {
  color: var(--muted);
}

.admin-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.admin-panel {
  padding: 14px;
}

.admin-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-section-head h2 {
  margin: 0;
}

.admin-add-button {
  min-width: 176px;
  padding: 0 14px;
}

.offer-group {
  display: grid;
  gap: 10px;
}

.offer-group + .offer-group {
  margin-top: 18px;
}

.offer-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.offer-group__head h3 {
  margin: 0;
  font-size: 15px;
}

.offer-group__head span {
  display: grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #d7b4ff;
  background: rgba(189, 112, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.offer-group__empty {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
}

.offer-stats-panel {
  margin-top: 12px;
}

.offer-stats-table {
  display: grid;
}

.offer-stats-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(80px, 0.7fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 52px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 13px;
}

.offer-stats-row--head {
  min-height: 44px;
  border-top: 0;
  color: rgba(226, 216, 246, 0.66);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.offer-stats-row strong {
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.offer-stats-row span:not(:first-child) {
  font-weight: 800;
}

.offer-stats-empty {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 16px 0 4px;
  color: var(--muted);
  text-align: center;
}

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

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

.admin-offers-grid > .admin-offer-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - 10px) / 2);
}

.admin-offer-actions {
  display: grid;
  gap: 7px;
}

.offer-toggle-button {
  min-height: 38px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 750;
}

.offer-toggle-button.is-off {
  background: rgba(255, 77, 109, 0.18);
  color: #ffc7d2;
}

.offer-toggle-button.is-on {
  background: rgba(46, 229, 111, 0.16);
  color: #b8ffd3;
}

.admin-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(5, 3, 12, 0.72);
  backdrop-filter: blur(14px);
}

.filter-modal {
  width: min(100%, 420px);
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  padding: 14px;
  background:
    radial-gradient(circle at 18% 0%, rgba(157, 76, 255, 0.18), transparent 40%),
    #141022;
  box-shadow: var(--shadow);
}

.filter-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-modal__head h2 {
  margin: 0;
  font-size: 20px;
}

.filter-modal__head span {
  color: var(--muted);
  font-size: 13px;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: var(--text);
}

.filter-group {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.filter-group > span {
  color: var(--muted);
  font-size: 12px;
}

.filter-segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.filter-segments button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.filter-segments button.is-active {
  color: var(--text);
  background: linear-gradient(180deg, var(--violet), var(--violet-2));
}

.filter-apply {
  width: 100%;
  margin-top: 14px;
}

.edit-modal {
  width: min(100%, 720px);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  padding: 14px;
  background:
    radial-gradient(circle at 18% 0%, rgba(157, 76, 255, 0.18), transparent 40%),
    #141022;
  box-shadow: var(--shadow);
}

.edit-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.edit-modal__head h2 {
  margin: 0;
  font-size: 20px;
}

.edit-modal__head span {
  color: var(--muted);
  font-size: 13px;
}

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

.edit-field {
  display: grid;
  gap: 6px;
}

.edit-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.edit-field b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #d7b4ff;
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 800;
}

.edit-field input,
.edit-field select {
  min-height: 41px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.edit-field select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #d7b4ff 50%) right 17px center / 7px 7px no-repeat,
    linear-gradient(135deg, #d7b4ff 50%, transparent 50%) right 11px center / 7px 7px no-repeat,
    rgba(255, 255, 255, 0.06);
}

.offer-editor-modal {
  width: min(100%, 760px);
  padding-bottom: 12px;
}

.offer-editor-preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.offer-editor-preview > span {
  justify-self: start;
  color: var(--muted);
  font-size: 12px;
}

.offer-preview-card {
  width: min(100%, 218px);
  min-height: 244px;
  pointer-events: none;
}

.offer-preview-card .favorite-button,
.offer-preview-card .apply-button {
  pointer-events: none;
}

.offer-editor-title-fields {
  display: grid;
  margin-bottom: 12px;
}

.offer-editor-title-fields .edit-field input {
  min-height: 54px;
  font-size: 16px;
  font-weight: 750;
}

.avatar-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 12px;
  background:
    radial-gradient(circle at 10% 0%, rgba(157, 76, 255, 0.16), transparent 48%),
    rgba(255, 255, 255, 0.035);
}

.avatar-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.avatar-block__head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.avatar-block__head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.avatar-block__sample {
  flex: 0 0 auto;
}

.avatar-letters-field input {
  min-height: 48px;
  font-size: 18px;
  font-weight: 850;
}

.avatar-palette {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 7px;
}

.avatar-palette button {
  min-height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.avatar-palette button.is-active {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(157, 76, 255, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.avatar-color-picker {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.avatar-color-picker input {
  width: 58px;
  height: 38px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.offer-editor-fields,
.offer-editor-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.offer-editor-extra {
  margin-top: 10px;
}

.edit-range-field {
  display: grid;
  gap: 7px;
  align-content: center;
  min-height: 96px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.045);
}

.edit-range-field span {
  color: var(--muted);
  font-size: 12px;
}

.edit-range-field strong {
  color: var(--text);
  font-size: 17px;
}

.edit-range-field input[type="range"] {
  width: 100%;
  accent-color: var(--violet);
}

.offer-editor-fields .edit-field {
  align-content: end;
}

.offer-editor-fields .edit-field input {
  min-height: 54px;
  font-size: 16px;
  font-weight: 750;
}

.edit-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0;
  color: var(--muted);
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
}

.delete-offer-button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border-radius: 8px;
  color: #ffc7d2;
  font-weight: 800;
  background: rgba(255, 77, 109, 0.18);
}

.primary-button {
  background: linear-gradient(180deg, #35ee7e, #159447);
  color: #06150b;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.07);
}

.danger-button {
  background: rgba(255, 77, 109, 0.18);
  color: #ffc7d2;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.7fr 90px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.admin-row strong {
  display: block;
}

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

.admin-row--admins {
  grid-template-columns: 1fr 120px;
}

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

.admin-person strong,
.admin-person span {
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .stats-grid,
  .admin-form,
  .edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .offer-editor-fields,
  .offer-editor-extra {
    grid-template-columns: 1fr;
  }

  .offer-editor-modal {
    width: min(100%, 440px);
  }

  .avatar-palette {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .period-panel__head,
  .period-panel__body,
  .period-custom {
    grid-template-columns: 1fr;
  }

  .period-panel__head {
    display: grid;
  }

  .period-panel__head span {
    text-align: left;
  }

  .period-custom {
    gap: 9px;
  }

  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-add-button {
    width: 100%;
  }

  .offer-stats-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(64px, 0.55fr) minmax(86px, 0.85fr);
    gap: 8px;
  }

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

@media (max-width: 360px) {
  .offers-grid,
  .admin-offers-grid,
  .quick-grid,
  .stats-grid,
  .admin-form,
  .edit-grid,
  .offer-editor-fields,
  .offer-editor-extra {
    grid-template-columns: 1fr;
  }

  .offers-grid > .offer-card:last-child:nth-child(odd) {
    width: 100%;
  }

  .admin-offers-grid > .admin-offer-card:last-child:nth-child(odd) {
    width: 100%;
  }
}
