:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #fff5f5;
  --text: #221d1d;
  --muted: #7b6d6d;
  --line: rgba(132, 28, 36, 0.12);
  --brand: #da1f34;
  --brand-dark: #b3192b;
  --shadow: 0 20px 60px rgba(95, 17, 25, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, Arial, sans-serif; }
body { min-height: 100vh; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
}

.topbar__inner,
.page {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar__inner {
  display: grid;
  grid-template-columns: 260px minmax(240px, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 78px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand__text strong {
  font-size: 22px;
  line-height: 1;
}

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

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 48px;
  padding: 0 14px;
}

.search svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  color: var(--muted);
  flex: 0 0 auto;
}

.search input {
  border: 0;
  background: transparent;
  outline: 0;
  width: 100%;
  color: var(--text);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quiet-link {
  color: var(--muted);
  font-weight: 600;
}

.account-menu-wrap {
  position: relative;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  color: var(--text);
}

.account-trigger__avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 3px solid #ef3348;
  box-shadow: 0 0 0 3px #ffe1e5;
  color: var(--brand-dark);
  font-weight: 800;
  flex: 0 0 auto;
}

.account-trigger__label {
  font-weight: 700;
}

.account-trigger__caret {
  color: var(--muted);
  font-size: 12px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 22px 64px rgba(39, 18, 6, 0.18);
  overflow: hidden;
  z-index: 50;
}

.account-menu__head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.account-menu__head strong,
.account-menu__head span {
  display: block;
}

.account-menu__head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.account-menu__avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff3f4, #ffffff);
  border: 3px solid rgba(218, 31, 52, 0.68);
  box-shadow: 0 0 0 3px #ffe0e4;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--brand-dark);
}

.account-menu__region {
  margin: 14px 16px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: #fff1f2;
  color: #8c3d45;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.account-menu__item {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.account-menu__item--danger {
  color: #b2432f;
}

.page {
  padding: 28px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
}

.hero-slider,
.hero-card,
.side-panel,
.showcase-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-slider {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}

.hero-slider__track,
.hero-slider__slide {
  position: absolute;
  inset: 0;
}

.hero-slider__slide {
  opacity: 0;
  transition: opacity 0.45s ease;
}

.hero-slider__slide.is-active {
  opacity: 1;
}

.hero-slider__slide img,
.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-rail {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 18px;
}

.hero-card {
  overflow: hidden;
}

.hero-card--side {
  min-height: 160px;
}

.hero-card img,
.hero-slider__slide img {
  object-fit: cover;
  object-position: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.workspace__main {
  min-width: 0;
}

.workspace__side {
  position: sticky;
  top: 98px;
  display: grid;
  gap: 16px;
}

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

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

.section-head p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

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

.showcase-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.showcase-card[hidden] {
  display: none !important;
}

.showcase-card__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff475b, #d91d33);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.showcase-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
}

.showcase-card strong {
  font-size: 22px;
}

.showcase-card span {
  color: var(--muted);
}

.showcase-card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(218, 31, 52, 0.5);
  color: var(--brand);
  font-weight: 800;
}

.side-panel {
  padding: 20px;
}

.side-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.side-panel__head h3 {
  margin: 0;
  font-size: 20px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  padding: 0;
  font-weight: 700;
}

.account-state strong {
  display: block;
  font-size: 20px;
}

.account-state p,
.hint,
.wallet-balance small {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.stats {
  display: grid;
  gap: 12px;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.stats dt,
.stats dd {
  margin: 0;
}

.stats dt { color: var(--muted); }
.stats dd { font-weight: 700; }

.wallet-balance {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: linear-gradient(135deg, #5f121d, #d51f35);
  border-radius: 16px;
  color: #fff6ec;
  margin-bottom: 14px;
}

.wallet-balance strong {
  font-size: 30px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

.button:hover { transform: translateY(-1px); }
.button[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.button--primary { background: linear-gradient(135deg, var(--brand), #ff4156); color: white; }
.button--block { width: 100%; }

.modal[hidden],
.toast[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 12, 0.58);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 24px));
  margin: 48px auto;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(19, 10, 6, 0.24);
  padding: 22px;
}

.modal__panel--wide {
  width: min(980px, calc(100vw - 24px));
}

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

.modal__head h3 {
  margin: 0;
  font-size: 24px;
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 22px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: var(--surface-2);
  border-radius: 14px;
  margin-bottom: 18px;
}

.tabs__button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.tabs__button.is-active {
  background: #fff;
  box-shadow: 0 6px 18px rgba(95, 51, 19, 0.08);
}

.form { display: grid; gap: 4px; }
.form--topup { gap: 10px; }

.topup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

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

.gate-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}

.gate-card.is-active {
  border-color: rgba(218, 31, 52, 0.7);
  background: rgba(255, 239, 241, 0.95);
}

.gate-card strong {
  display: block;
  font-size: 16px;
}

.gate-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.quick-amounts button {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 700;
}

.payment-result {
  min-height: 100%;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff4f5, #fff);
  border: 1px solid var(--line);
}

.payment-result__qr {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
}

.payment-result code {
  display: inline-flex;
  margin-top: 10px;
  padding: 8px 10px;
  background: #2b1c14;
  color: white;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 24px));
  padding: 14px 16px;
  background: #2f1a0f;
  color: white;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(23, 11, 6, 0.28);
}

@media (max-width: 1180px) {
  .topbar__inner { grid-template-columns: 220px minmax(0, 1fr); }
  .topbar__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .hero { grid-template-columns: 1fr; }
  .hero-slider { min-height: 420px; }
  .hero-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  .workspace { grid-template-columns: 1fr; }
  .workspace__side { position: static; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .showcase-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .topbar__inner,
  .page { width: min(100vw - 20px, 100%); }
  .topbar__inner { grid-template-columns: 1fr; gap: 12px; padding: 12px 0; }
  .search { order: 3; }
  .topbar__actions { justify-content: space-between; }
  .hero-slider { min-height: 260px; }
  .hero-rail,
  .showcase-grid,
  .workspace__side,
  .gate-list,
  .quick-amounts,
  .topup-layout { grid-template-columns: 1fr; }
  .hero-rail { grid-template-rows: repeat(3, 140px); }
  .section-head { align-items: start; flex-direction: column; }
  .modal__panel,
  .modal__panel--wide { width: calc(100vw - 16px); margin: 18px auto; padding: 16px; }
}
