:root {
  --bg-a: #fffaf2;
  --bg-b: #ffe4b8;
  --bg-c: #ffd19a;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(173, 126, 79, 0.26);
  --text-main: #3f2b1b;
  --text-soft: #7c6249;
  --accent: #d86b25;
  --accent-strong: #b65214;
  --teal: #1f7a6c;
  --warning: #a4561a;
  --shadow: 0 18px 40px rgba(128, 74, 24, 0.16);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text-main);
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 255, 255, 0.8) 0 16%, transparent 17%),
    radial-gradient(circle at 92% 24%, rgba(255, 229, 187, 0.9) 0 15%, transparent 16%),
    linear-gradient(150deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
  padding: 18px;
}

body.overlay-open {
  overflow: hidden;
}

.app {
  width: min(420px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  animation: enter 500ms ease;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #fff7ed, #ffe8cc);
}

.brand h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.3px;
  text-align: center;
}

.brand p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

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

.badge-row {
  display: grid;
  width: 100%;
  gap: 8px;
}

.badge-row-top {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.chip {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  text-align: center;
  white-space: nowrap;
}

.badge-row-bottom .chip {
  font-size: 11px;
  padding: 6px 8px;
}

.period-infinity {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  display: inline;
  vertical-align: baseline;
}

.chip.free {
  color: var(--warning);
  border-color: rgba(164, 86, 26, 0.35);
  background: #fff2e6;
}

.chip.pro {
  color: #1f7a6c;
  border-color: rgba(31, 122, 108, 0.35);
  background: #eaf8f5;
}

.chip.time {
  color: var(--teal);
  border-color: rgba(31, 122, 108, 0.35);
  background: #eaf8f5;
}

.chip.info {
  color: #6d5238;
  border-color: rgba(109, 82, 56, 0.3);
  background: #fff9f0;
}

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

.menu-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  color: var(--text-main);
  border-radius: var(--radius-md);
  min-height: 56px;
  padding: 14px 16px;
  text-align: center;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0.2px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.menu-btn:hover {
  transform: translateY(-1px);
  background: #fff5e9;
}

.menu-btn.active {
  background: #ffe6c7;
  border-color: rgba(184, 82, 20, 0.45);
  color: #5f2b09;
}

.pro-tip {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
  padding: 10px 12px;
  border: 1px dashed rgba(184, 82, 20, 0.35);
  border-radius: 12px;
  background: #fff8ef;
}

.pro-demo-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.56);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.overlay-wrap {
  position: fixed;
  inset: 0;
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  z-index: 35;
}

.overlay-wrap.open {
  display: flex;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 255, 255, 0.8) 0 16%, transparent 17%),
    radial-gradient(circle at 92% 24%, rgba(255, 229, 187, 0.9) 0 15%, transparent 16%),
    linear-gradient(150deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
}

.overlay-card {
  width: min(420px, 100%);
  height: 100%;
  z-index: 1;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(145deg, #fff7ed, #ffe8cc);
}

.content {
  padding: 12px 12px 14px;
  display: grid;
  gap: 12px;
  position: relative;
  height: 100%;
  overflow: hidden;
}

.overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8ef;
  color: var(--text-main);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
}

.tab-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #fff7ed, #ffe8cc);
  padding: 16px;
  opacity: 0;
  transform: translateY(10px);
}

.tab-panel.active {
  display: block;
  animation: panelIn 260ms ease forwards;
}

.title {
  margin: 0 0 14px;
  font-size: 20px;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  background: #fffdf9;
  color: var(--text-main);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 180ms ease, filter 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
}

.btn.ghost {
  color: var(--accent-strong);
  background: #fff3e6;
  border: 1px solid rgba(184, 82, 20, 0.22);
}

.settings-list {
  display: grid;
  gap: 6px;
}

.settings-panel {
  position: relative;
}

.profile-panel {
  position: relative;
}

.settings-inline-notice {
  display: none;
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  z-index: 5;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(31, 122, 108, 0.35);
  background: #eaf8f5;
  color: #1f7a6c;
  font-size: 15px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
}

.settings-inline-notice.show {
  display: flex;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  padding: 11px 12px;
}

.setting-item .meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.setting-item .name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-item .value {
  font-size: 13px;
  color: #5f2b09;
  font-weight: 700;
}

.setting-item .desc {
  color: var(--text-soft);
  font-size: 12px;
}

.setting-item.locked button {
  background: #fff1df;
  color: #9b4c13;
  border: 1px dashed rgba(184, 82, 20, 0.45);
}

.setting-item button {
  border: 0;
  border-radius: 999px;
  padding: 8px 11px;
  font-weight: 700;
  background: #e9f7f4;
  color: #1f7a6c;
  cursor: pointer;
}

.setting-item.pro-active {
  background: rgba(255, 255, 255, 0.56);
  border-color: var(--line);
}

.free-only {
  display: block;
}

.pro-only {
  display: none;
}

.setting-item.pro-active .free-only {
  display: none;
}

.setting-item.pro-active .pro-only {
  display: block;
}

.setting-item .locked-control.free-only {
  display: inline-flex;
  align-items: center;
}

.pro-control {
  margin-top: 4px;
}

.pro-control select,
.pro-control input[type="time"] {
  height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  width: min(180px, 100%);
}

.pro-control.compact-right {
  margin-top: 0;
}

.pro-control.compact-right.select-fixed {
  flex: 0 0 136px;
  width: 136px;
}

.state-toggle {
  min-width: 62px;
  border: 1px solid rgba(31, 122, 108, 0.25);
  background: #e9f7f4;
  color: #1f7a6c;
  font-weight: 700;
}

.state-toggle.on {
  border-color: rgba(31, 122, 108, 0.35);
  background: #e9f7f4;
  color: #1f7a6c;
}

.state-toggle.off {
  border-color: rgba(184, 82, 20, 0.35);
  background: #fff1ea;
  color: #b65214;
}

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

.plan {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 74px;
  cursor: pointer;
  background: #fff9f0;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.plan:hover {
  transform: translateY(-1px);
}

.plan.active {
  border-color: rgba(184, 82, 20, 0.45);
  background: #ffe8c9;
}

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

.plan .name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
}

.plan .price {
  margin-top: 0;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.plan-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.discount-badge {
  display: inline-block;
  margin-left: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #ff8b3d, #d95f18);
  animation: discountPulse 1.8s ease-in-out infinite;
}

.points-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.56);
  display: grid;
  gap: 8px;
}

.points-box.compact {
  gap: 8px;
}

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

.points-balance {
  font-weight: 700;
  font-size: 14px;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.switch-sm {
  width: 46px;
  height: 26px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e6d4bf;
  border: 1px solid var(--line);
  transition: background 180ms ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 180ms ease;
}

.switch-sm .switch-slider::before {
  width: 18px;
  height: 18px;
}

.switch input:checked + .switch-slider {
  background: #d2f1ea;
}

.switch input:checked + .switch-slider::before {
  transform: translateX(21px);
}

.switch-sm input:checked + .switch-slider::before {
  transform: translateX(19px);
}

.promo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.promo-row input {
  width: 100%;
  min-width: 150px;
  font-size: 13px;
  padding: 9px 10px;
}

.promo-row .btn {
  padding: 9px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.calc {
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  display: grid;
  gap: 3px;
  font-size: 13px;
}

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

.calc .row.total {
  margin-top: 1px;
  font-size: 15px;
  font-weight: 800;
}

.calc .row.total strong {
  font-size: 18px;
}

.points-box .btn.primary {
  margin-top: 1px;
}

.pay-total {
  display: none;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  font-size: 16px;
  font-weight: 700;
}

.pay-total strong {
  font-size: 20px;
}

.ref-row {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.ref-program {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  padding: 10px 12px;
}

.ref-program p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.ref-program p + p {
  margin-top: 6px;
}

.ref-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.56);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}

.ref-card .key {
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-main);
  font-weight: 800;
}

.ref-card .num {
  margin-top: 0;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.table {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(173, 126, 79, 0.18);
  background: rgba(255, 255, 255, 0.56);
  font-size: 13px;
}

.table-row.two-cols {
  grid-template-columns: 1fr auto;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.head {
  font-weight: 800;
  background: rgba(255, 255, 255, 0.72);
}

.ref-scroll {
  max-height: clamp(280px, 52vh, 430px);
  overflow-y: auto;
}

.inline-notice {
  display: none;
  border: 1px solid rgba(31, 122, 108, 0.35);
  background: #eaf8f5;
  color: #1f7a6c;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

.inline-notice.show {
  display: block;
}

.support-panel {
  position: relative;
}

.payment-panel {
  position: relative;
}

.payment-overlay-notice {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 118px;
  z-index: 6;
  min-height: 124px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 700;
  padding: 16px 14px;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(47, 104, 89, 0.18);
}

.payment-overlay-notice.error {
  color: #9b4c13;
  border-color: rgba(184, 82, 20, 0.35);
  background: #fff3e5;
}

.payment-overlay-notice.applied {
  color: #1f7a6c;
  border-color: rgba(31, 122, 108, 0.35);
  background: #eaf8f5;
}

.payment-overlay-notice.show {
  display: flex;
}

.overlay-notice {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 62px;
  bottom: 82px;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  padding: 18px 14px;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(47, 104, 89, 0.2);
}

.overlay-notice.show {
  display: flex;
}

.support-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(38, 21, 11, 0.36);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-wrap.open {
  display: flex;
}

.modal {
  width: min(440px, 100%);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #fff7ed, #ffe8cc);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal h3 {
  margin: 0;
  font-size: 21px;
}

.modal p {
  margin: 10px 0 0;
  color: #6f533a;
  line-height: 1.45;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff8ee;
  color: var(--text-main);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 70;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .sidebar {
    padding: 16px;
  }

  .menu-btn {
    font-size: 22px;
  }

  .ref-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .table-row.two-cols {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 520px) {
  body {
    padding: 10px;
  }

  .menu-btn {
    font-size: 20px;
    min-height: 52px;
  }

  .overlay-wrap {
    padding: 0;
  }

  .content {
    padding: 10px;
  }

  .overlay-close {
    width: 36px;
    height: 36px;
    font-size: 26px;
  }

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

  .plan .price {
    font-size: 23px;
  }

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

  .promo-row .btn {
    width: 100%;
  }

  .overlay-notice {
    left: 12px;
    right: 12px;
    top: 58px;
    bottom: 76px;
    font-size: 21px;
  }

  .payment-overlay-notice {
    left: 12px;
    right: 12px;
    top: 108px;
    font-size: 21px;
    min-height: 116px;
  }
}

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

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

@keyframes discountPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.03);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
