:root {
  --atilla-blue: #356694;
  --atilla-blue-dark: #274d71;
  --atilla-blue-soft: #d8e8f6;
  --porcelain: #f4efe4;
  --sand: #e6dbc6;
  --ink: #152335;
  --ink-soft: #4d5f74;
  --white: #ffffff;
  --danger: #b13a3a;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 20px 45px rgba(27, 49, 73, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -20%, rgba(53, 102, 148, 0.34), transparent 45%),
    radial-gradient(circle at -5% 35%, rgba(214, 196, 166, 0.42), transparent 38%),
    linear-gradient(165deg, #f9f6ee 0%, #f4efe4 52%, #edf2f8 100%);
}

body {
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

.lang-switch {
  position: fixed;
  top: calc(max(14px, env(safe-area-inset-top)) + 18px);
  right: 14px;
  z-index: 4;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(53, 102, 148, 0.14);
  backdrop-filter: blur(8px);
}

.lang-btn {
  border: 0;
  border-radius: 999px;
  min-width: 48px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--atilla-blue-dark);
  background: transparent;
  cursor: pointer;
}

.lang-btn.active {
  color: var(--white);
  background: linear-gradient(135deg, #356694, #274d71);
}

.bg-ornament {
  position: fixed;
  pointer-events: none;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(32px);
  z-index: 0;
}

.bg-ornament-top {
  top: -130px;
  right: -60px;
  background: rgba(53, 102, 148, 0.26);
}

.bg-ornament-bottom {
  bottom: -160px;
  left: -100px;
  background: rgba(209, 187, 148, 0.36);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-hidden {
  display: none;
}

.auth-screen {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 460px);
  padding: 22px;
}

.auth-card .btn {
  width: 100%;
  margin-top: 6px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.auth-field span {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.auth-field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.68);
}

.auth-hint {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-screen.hidden {
  display: none;
}

.glass {
  background: linear-gradient(130deg, rgba(53, 102, 148, 0.96), rgba(39, 77, 113, 0.94));
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.glass .label {
  color: rgba(255, 255, 255, 0.9);
}

.hero {
  animation: rise 460ms ease;
}

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

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  overflow: hidden;
  padding: 4px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
}

h1,
h2 {
  margin: 0;
  font-family: "Marcellus", serif;
  font-weight: 400;
  letter-spacing: 0.2px;
}

h1 {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
}

h2 {
  font-size: 1.3rem;
}

.hero-copy {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.4;
}

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

.metric-card,
.metric-wide,
.panel {
  background: rgba(255, 255, 255, 0.87);
  border: 1px solid rgba(53, 102, 148, 0.1);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(27, 49, 73, 0.06);
}

.metric-card {
  animation: rise 420ms ease both;
}

.metric-card:nth-child(2) {
  animation-delay: 90ms;
}

.label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-value {
  margin: 8px 0 5px;
  font-size: 1.36rem;
  font-weight: 800;
  line-height: 1.1;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem;
  line-height: 1;
}

.metric-value.wide {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.metric-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.progress-wrap {
  margin-top: 12px;
  width: 100%;
  height: 9px;
  background: #e9eef4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(92deg, #5f8eb9, #356694);
  transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--atilla-blue-dark);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--atilla-blue);
  color: var(--white);
  box-shadow: 0 10px 20px rgba(53, 102, 148, 0.22);
}

.panel {
  display: none;
  animation: rise 250ms ease;
}

.panel.visible {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chip {
  background: var(--atilla-blue-soft);
  color: var(--atilla-blue-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
}

.sales-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sale-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #deebf8;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.sale-item:hover {
  transform: translateY(-1px);
  border-color: #b9d6f2;
  box-shadow: 0 10px 18px rgba(33, 71, 108, 0.08);
}

.sale-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sale-title {
  font-weight: 700;
}

.sale-sub {
  font-size: 0.83rem;
  color: var(--ink-soft);
}

.sale-amount {
  font-weight: 800;
  color: var(--atilla-blue-dark);
}

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

.profile-info-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #b9d3ea;
  border-radius: 50%;
  background: linear-gradient(145deg, #edf6ff, #d8eaf9);
  color: #1f4f78;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 14px rgba(33, 71, 108, 0.08);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.profile-info-btn:hover {
  transform: translateY(-1px);
  border-color: #93c0e4;
  box-shadow: 0 12px 20px rgba(33, 71, 108, 0.13);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 14px;
}

.profile-item {
  border: 1px solid #dfebf5;
  background: #f9fbff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-item span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.bonus-history-wrap {
  margin-top: 8px;
}

.bonus-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.bonus-history-head h3 {
  margin: 0;
  font-size: 1rem;
}

.bonus-history-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.bonus-history-item {
  border: 1px solid #deebf7;
  border-radius: 12px;
  background: #f8fbff;
  padding: 9px 10px;
  display: grid;
  gap: 6px;
}

.bonus-history-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.bonus-history-month {
  text-transform: capitalize;
}

.bonus-history-stage {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.76rem;
  font-weight: 800;
}

.bonus-history-item-body {
  display: grid;
  gap: 2px;
}

.bonus-history-amount {
  font-size: 1rem;
  color: #224f78;
}

.bonus-history-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.profile-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.btn-logout {
  background: linear-gradient(135deg, #fff2f2, #ffe3e3);
  border: 1px solid #efb7b7;
  color: #9f2f2f;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, #356694, #274d71);
  color: var(--white);
}

.btn-light {
  background: #e8f1f9;
  color: #274d71;
}

.panel-text {
  margin: 8px 0 12px;
  color: var(--ink-soft);
}

.broadcast-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.broadcast-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

select,
textarea {
  font: inherit;
  border: 1px solid #cfe0ef;
  background: #fbfdff;
  border-radius: 10px;
  padding: 10px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.hint-box {
  margin-top: 12px;
  border-radius: 12px;
  background: #f4f8fd;
  border: 1px solid #dae8f6;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.stage-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14, 25, 38, 0.5);
  backdrop-filter: blur(5px);
}

.stage-card {
  position: relative;
  width: min(100%, 520px);
  border-radius: 24px;
  padding: 22px;
  color: var(--white);
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.28), transparent 40%),
    linear-gradient(145deg, #2a5780 0%, #356694 52%, #4d87bb 100%);
  box-shadow: 0 22px 56px rgba(14, 27, 40, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.25);
  animation: stageIn 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.stage-kicker {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0.92;
}

.stage-title {
  margin: 8px 0 4px;
  font-size: clamp(1.42rem, 5vw, 2rem);
  line-height: 1.12;
  font-family: "Marcellus", serif;
}

.stage-subtitle {
  margin: 0 0 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

.stage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.stage-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 12px;
  padding: 10px 11px;
  font-weight: 700;
  line-height: 1.35;
}

.stage-pill-accent {
  background: rgba(255, 225, 166, 0.19);
  border-color: rgba(255, 235, 190, 0.55);
}

.stage-pre_stage {
  background: #e8f0ff;
  border-color: #bfd6ff;
  color: #2950a3;
}

.stage-start_booster {
  background: #e8fbf2;
  border-color: #b5f1d2;
  color: #1f8b56;
}

.stage-bronze_momentum {
  background: #fff1e7;
  border-color: #f9d4b8;
  color: #9a5124;
}

.stage-silver_impact {
  background: #f2f4f7;
  border-color: #d7dde7;
  color: #4a627d;
}

.stage-gold_elite {
  background: #fff7db;
  border-color: #f2df8f;
  color: #8d6b08;
}

.stage-platinum_legend {
  background: #efe9ff;
  border-color: #cdc0ff;
  color: #5a43b8;
}

.stage-card .btn {
  width: 100%;
}

.stage-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.stage-confetti span {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: 0.8;
  animation: confettiFall 1.8s linear infinite;
}

.stage-confetti span:nth-child(1) {
  left: 9%;
  background: #ffe7be;
  animation-delay: 0s;
}
.stage-confetti span:nth-child(2) {
  left: 22%;
  background: #fff;
  animation-delay: 0.25s;
}
.stage-confetti span:nth-child(3) {
  left: 38%;
  background: #cae8ff;
  animation-delay: 0.4s;
}
.stage-confetti span:nth-child(4) {
  left: 57%;
  background: #fff;
  animation-delay: 0.15s;
}
.stage-confetti span:nth-child(5) {
  left: 73%;
  background: #ffe0a0;
  animation-delay: 0.32s;
}
.stage-confetti span:nth-child(6) {
  left: 88%;
  background: #d5ecff;
  animation-delay: 0.5s;
}

.bonus-modal {
  position: fixed;
  inset: 0;
  z-index: 38;
  display: grid;
  place-items: center;
  padding: 14px;
}

.bonus-overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 27, 40, 0.48);
  backdrop-filter: blur(4px);
}

.bonus-card {
  position: relative;
  width: min(100%, 620px);
  max-height: min(88vh, 780px);
  overflow: auto;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.52), transparent 38%),
    linear-gradient(165deg, #ffffff 0%, #f5faff 100%);
  border: 1px solid #c7ddef;
  box-shadow: 0 22px 56px rgba(14, 27, 40, 0.24);
  padding: 16px;
  animation: rise 220ms ease;
}

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

.bonus-head h3 {
  margin: 0;
  font-family: "Marcellus", serif;
  font-weight: 400;
  font-size: 1.35rem;
}

.bonus-close {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e8f2fc;
  color: #2a5780;
  font-size: 1.2rem;
  cursor: pointer;
}

.bonus-subtitle {
  margin: 10px 0 10px;
  color: var(--ink-soft);
}

.bonus-rule-list {
  margin: 0 0 12px;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.bonus-stage-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.bonus-stage-row {
  border: 1px solid #deebf7;
  border-radius: 12px;
  background: #f8fbff;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.bonus-stage-meta {
  display: grid;
  gap: 4px;
}

.bonus-stage-name {
  font-weight: 800;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 8px;
}

.bonus-stage-range {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.bonus-stage-rate {
  font-size: 1rem;
  font-weight: 900;
  color: #21486d;
  white-space: nowrap;
}

.sale-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 14px;
}

.sale-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 28, 41, 0.45);
  backdrop-filter: blur(4px);
}

.sale-card {
  position: relative;
  width: min(100%, 640px);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #d3e1f0;
  box-shadow: 0 18px 44px rgba(15, 35, 56, 0.25);
  padding: 16px;
  animation: rise 220ms ease;
}

.sale-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sale-head h3 {
  margin: 0;
  font-family: "Marcellus", serif;
  font-weight: 400;
  font-size: 1.35rem;
}

.sale-close {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e8f2fc;
  color: #2a5780;
  font-size: 1.2rem;
  cursor: pointer;
}

.sale-meta {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sale-meta-item {
  border: 1px solid #deebf7;
  border-radius: 10px;
  background: #f8fbff;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sale-meta-item span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.sale-meta-item strong {
  overflow-wrap: anywhere;
}

.sale-items-wrap {
  margin-top: 12px;
}

.sale-items-wrap h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.sale-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sale-line {
  border: 1px solid #e1edf9;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfdff;
  display: grid;
  gap: 4px;
}

.sale-line-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.sale-line-name {
  font-weight: 700;
}

.sale-line-total {
  font-weight: 800;
  color: #224f78;
}

.sale-line-sub {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.hidden {
  display: none;
}

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

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes confettiFall {
  from {
    transform: translateY(-18px) rotate(0deg);
  }
  to {
    transform: translateY(280px) rotate(210deg);
  }
}

@media (max-width: 640px) {
  .card-row,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  .tab-btn {
    flex: 1;
  }

  .lang-switch {
    top: calc(max(10px, env(safe-area-inset-top)) + 20px);
    right: 10px;
  }

  .stage-card {
    padding: 18px;
    border-radius: 18px;
  }

  .sale-meta {
    grid-template-columns: 1fr;
  }

  .bonus-history-item-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-actions .btn {
    width: 100%;
  }

  .bonus-stage-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
