:root {
  color-scheme: dark;
  --page-gutter: 10px;
  --bg: #0a1020;
  --bg-soft: #10182b;
  --panel: rgba(20, 29, 48, 0.86);
  --panel-strong: #151f35;
  --ink: #f7fbff;
  --muted: #8c9ab3;
  --line: rgba(255, 255, 255, 0.1);
  --brand: #3d8cff;
  --brand-2: #8b5cf6;
  --cyan: #20c7dc;
  --amber: #f7a41a;
  --success: #20d49b;
  --danger: #ff6676;
  --card-radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: none;
  touch-action: manipulation;
  background:
    radial-gradient(circle at 78% 7%, rgba(58, 137, 255, 0.22), transparent 28%),
    linear-gradient(180deg, #060914 0%, #0a1020 48%, #0d1322 100%);
  color: var(--ink);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0 auto;
  padding:
    14px
    max(var(--page-gutter), env(safe-area-inset-right))
    calc(88px + env(safe-area-inset-bottom))
    max(var(--page-gutter), env(safe-area-inset-left));
  overflow-x: clip;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: manipulation;
  background:
    linear-gradient(180deg, rgba(12, 19, 35, 0.45), rgba(12, 19, 35, 0.94)),
    var(--bg);
}

.app.is-editing {
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.app::-webkit-scrollbar,
.content::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.hero {
  width: 100%;
  max-width: 100%;
  padding: calc(4px + env(safe-area-inset-top)) 0 8px;
}

.hero.is-hidden {
  display: none;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.profile {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #477bff, #8d63ff);
  box-shadow: 0 10px 26px rgba(61, 140, 255, 0.34);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-meta {
  min-width: 0;
  line-height: 1.25;
}

.profile-name {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 900;
}

.bot-name {
  max-width: 100%;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.refresh-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  color: #dbe8ff;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.refresh-button:active {
  transform: translateY(1px);
}

.refresh-button:disabled {
  opacity: 0.72;
}

.refresh-button.loading {
  animation: refresh-spin 0.8s linear infinite;
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.content {
  width: 100%;
  max-width: 100%;
  padding-top: 12px;
  overflow-x: clip;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.account-card {
  position: relative;
  min-height: 116px;
  margin-bottom: 12px;
  padding: 22px 18px;
  overflow: hidden;
  border: 1px solid rgba(119, 154, 255, 0.34);
  border-radius: var(--card-radius);
  background:
    radial-gradient(circle at 92% 5%, rgba(42, 202, 255, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(126, 67, 207, 0.78), rgba(25, 55, 105, 0.82) 48%, rgba(15, 25, 44, 0.94));
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

.account-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -35px;
  width: 138px;
  height: 138px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  box-shadow: -34px 35px 0 -33px rgba(255, 255, 255, 0.26);
}

.account-badge {
  position: absolute;
  top: 17px;
  right: 18px;
  z-index: 1;
  height: 30px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 900;
}

.account-grid {
  position: relative;
  z-index: 1;
  padding-right: 90px;
}

.account-label {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 800;
}

.account-value {
  margin-top: 12px;
  color: #fff;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
  white-space: nowrap;
}

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

.stat-card {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.9), rgba(16, 25, 43, 0.92));
  padding: 13px;
}

.stat-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.stat-value {
  margin-top: 12px;
  color: #fff;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 900;
}

.chart-card {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.94), rgba(14, 22, 39, 0.96));
  padding: 15px 12px 12px;
}

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

.chart-title {
  font-size: 15px;
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart {
  height: 168px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 7px;
  padding: 10px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-day {
  min-width: 0;
  display: grid;
  grid-template-rows: 124px 20px;
  align-items: end;
  gap: 8px;
}

.bar-group {
  height: 124px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.bar {
  width: 7px;
  min-height: 4px;
  border-radius: 999px 999px 2px 2px;
}

.bar.orders {
  background: linear-gradient(180deg, #58a6ff, #2774ff);
}

.bar.sales {
  background: linear-gradient(180deg, #25d3e6, #12a7bc);
}

.bar.profit {
  background: linear-gradient(180deg, #f7b955, #f59e0b);
}

.day-label {
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.section-title {
  margin: 4px 2px 12px;
  font-size: 19px;
  font-weight: 900;
}

.search-box {
  width: 100%;
  height: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.search-box::placeholder {
  color: var(--muted);
}

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

.list-footer {
  padding: 4px 0 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.list-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 12px;
}

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

.list-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.list-subtitle,
.field-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.kv {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 9px;
}

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

.kv-value {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #d7e4f8;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.success {
  background: rgba(32, 212, 155, 0.14);
  color: #40e6b1;
}

.tag.warning {
  background: rgba(247, 164, 26, 0.15);
  color: #ffc86a;
}

.tag.danger {
  background: rgba(255, 102, 118, 0.14);
  color: #ff8c98;
}

.settings-profile-card {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.94), rgba(14, 22, 39, 0.96));
  padding: 15px;
}

.settings-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #54a0ff, #2d79ff);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.settings-profile-main {
  min-width: 0;
}

.settings-name {
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-uid {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.settings-balance {
  text-align: right;
}

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

.settings-balance-value {
  margin-top: 8px;
  color: #ffc928;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.settings-menu {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.94), rgba(14, 22, 39, 0.96));
}

.settings-toolbar {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 74px;
  align-items: center;
}

.back-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  color: #dbe8ff;
  font-size: 13px;
  font-weight: 900;
}

.settings-toolbar-title {
  text-align: center;
  font-size: 17px;
  font-weight: 900;
}

.settings-row {
  min-height: 64px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.settings-row-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
}

.settings-row-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.settings-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.settings-row-icon.language {
  background: rgba(14, 165, 233, 0.22);
  color: #31c9f4;
}

.settings-row-icon.support {
  background: rgba(245, 158, 11, 0.19);
  color: #f8b33b;
  font-size: 18px;
}

.settings-row-icon.bot {
  background: rgba(139, 92, 246, 0.2);
  color: #a98cff;
}

.settings-row-icon.product {
  background: rgba(32, 212, 155, 0.16);
  color: #40e6b1;
}

.settings-row-icon.keyboard {
  background: rgba(88, 166, 255, 0.18);
  color: #70b7ff;
  font-size: 16px;
}

.language-segment {
  flex: 0 0 auto;
  height: 36px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(2, 60px);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.language-segment button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.language-segment button.active {
  background: linear-gradient(135deg, #54a0ff, #2d79ff);
  color: #fff;
}

.settings-row-value {
  min-width: 0;
  color: #ffc928;
  font-size: 14px;
  font-weight: 900;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-version {
  padding: 12px 4px 0;
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.settings-chevron {
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
}

.form-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: 14px;
}

.settings-panel-title {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 900;
}

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

.settings-panel-head .settings-panel-title {
  margin-bottom: 0;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #d7e4f8;
  font-size: 13px;
  font-weight: 900;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  outline: none;
}

.field input {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

#welcomeText {
  min-height: 190px;
  line-height: 1.5;
}

.product-price-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.product-price-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 11px;
}

.product-price-info {
  min-width: 0;
}

.product-price-name {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-price-input {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.product-price-input input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #54a0ff, #2d79ff);
  color: #fff;
  font-weight: 900;
}

.secondary-button {
  flex: 0 0 auto;
  height: 34px;
  border: 1px solid rgba(84, 160, 255, 0.45);
  border-radius: 11px;
  background: rgba(84, 160, 255, 0.13);
  color: #8ec5ff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 900;
}

.text-danger-button {
  border: 0;
  background: transparent;
  color: #ff8c98;
  font-size: 13px;
  font-weight: 900;
}

.keyboard-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.keyboard-item {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
}

.keyboard-item .field:last-child {
  margin-bottom: 0;
}

.keyboard-item-head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.tabbar {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
  width: auto;
  height: 66px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  background: rgba(20, 29, 48, 0.92);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.app.is-editing .tabbar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(100% + 24px));
}

.tab {
  min-width: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: rgba(255, 255, 255, 0.56);
  display: grid;
  grid-template-rows: 23px 18px;
  place-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 800;
}

.tab.active {
  background: rgba(61, 140, 255, 0.18);
  color: #63a6ff;
}

.tab-icon {
  font-size: 21px;
  line-height: 1;
}

.toast {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  z-index: 30;
  transform: translate(-50%, -16px);
  max-width: calc(100vw - 28px);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(247, 251, 255, 0.94);
  color: #101820;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

@media (min-width: 560px) {
  .app {
    max-width: 390px;
    margin: 0 auto;
    padding-left: 10px;
    padding-right: 10px;
  }

  .tabbar {
    left: 50%;
    right: auto;
    width: 370px;
    transform: translateX(-50%);
  }

  .app.is-editing .tabbar {
    transform: translateX(-50%) translateY(calc(100% + 24px));
  }
}
