:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #fff7fb;
  color: #2b2436;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.mini-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 236, 246, 0.92) 0 18%, transparent 18% 100%),
    linear-gradient(225deg, rgba(220, 248, 250, 0.9) 0 22%, transparent 22% 100%),
    linear-gradient(180deg, #fff9fd 0, #f7fbff 58%, #fff6ee 100%);
}

.mini-app {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 12px calc(148px + env(safe-area-inset-bottom));
}

.mini-view {
  display: none;
  animation: viewIn 0.24s ease both;
}

.mini-view.active {
  display: block;
}

.mini-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-height: 120px;
  padding: 14px 6px 20px;
}

.me-hero {
  min-height: 108px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #ff6f91;
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
p,
figure {
  margin: 0;
}

.mini-hero h1 {
  color: #21182f;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 240px;
  margin-top: 10px;
  color: #766b85;
  font-size: 13px;
  line-height: 1.55;
}

.sparkle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #ffd166;
  transform: rotate(45deg);
  animation: twinkle 2.4s ease-in-out infinite;
}

.sparkle::after {
  position: absolute;
  inset: 3px;
  border-radius: 2px;
  background: #ffffff;
  content: "";
}

.sparkle.one {
  top: 24px;
  right: 118px;
}

.sparkle.two {
  top: 58px;
  right: 82px;
  width: 9px;
  height: 9px;
  background: #9be7e5;
  animation-delay: 0.6s;
}

.sparkle.three {
  top: 34px;
  right: 92px;
  background: #ff9ebb;
}

.fresh-badge {
  flex: 0 0 auto;
  min-width: 84px;
  border: 1px solid rgba(255, 158, 187, 0.42);
  border-radius: 999px;
  background: #ffffff;
  color: #ff6f91;
  padding: 9px 13px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(255, 111, 145, 0.18);
}

.product-panel,
.control-panel,
.metric-panel,
.chart-section,
.mini-disclaimer,
.me-card,
.me-panel,
.section-card {
  margin-top: 12px;
  border: 1px solid rgba(246, 200, 221, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(118, 97, 138, 0.1);
}

.product-panel {
  position: relative;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  overflow: hidden;
}

.product-panel::before,
.metric-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, #ff9ebb, #ffd166, #9be7e5);
  content: "";
}

.cute-float {
  animation: floatSoft 4.8s ease-in-out infinite;
}

.product-cover {
  width: 116px;
}

.product-cover img {
  display: block;
  width: 116px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #f4ccd9;
  border-radius: 8px;
  background: #fff7fb;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.58);
}

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

.product-id,
.product-info p {
  color: #766b85;
  font-size: 13px;
  line-height: 1.45;
}

.product-info h2 {
  margin: 7px 0 7px;
  color: #21182f;
  font-size: 23px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.control-panel,
.metric-panel,
.chart-section,
.mini-disclaimer,
.me-panel,
.section-card {
  padding: 16px;
}

.metric-panel {
  position: relative;
  overflow: hidden;
}

.section-head,
.section-title {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.section-head h2,
.section-title h2,
.mini-disclaimer h2,
.me-card h2 {
  color: #21182f;
  font-size: 18px;
  line-height: 1.25;
}

.section-head p,
.section-title p,
.subtitle,
.mini-disclaimer p,
.disclaimer p,
.me-card p {
  color: #766b85;
  font-size: 14px;
  line-height: 1.6;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-fields {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  margin-top: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #665975;
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 47px;
  border: 1px solid #f0cbd8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffafd;
  color: #21182f;
  outline: none;
}

input:focus,
select:focus {
  border-color: #ff8fab;
  box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.14);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  display: grid;
  gap: 8px;
  min-height: 88px;
  border: 1px solid #efdce8;
  border-radius: 8px;
  background: #fffafd;
  padding: 13px;
}

.stat span {
  color: #766b85;
  font-size: 13px;
}

.stat strong {
  color: #21182f;
  font-size: 25px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.hero-stat {
  background: #effcfc;
  border-color: #bfeceb;
}

.stat.accent {
  background: #fff3f6;
  border-color: #ffc5d5;
}

.chart-card {
  min-height: 210px;
  overflow: hidden;
  border: 1px solid #efdce8;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0, #fffafd 100%);
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-label {
  fill: #5b4f6a;
  font-size: 13px;
  font-weight: 900;
}

.chart-time {
  fill: #766b85;
  font-size: 12px;
}

.empty-chart {
  display: grid;
  min-height: 210px;
  place-items: center;
  color: #766b85;
  font-size: 14px;
}

.small-empty {
  min-height: 72px;
}

.events-list {
  display: grid;
  gap: 9px;
}

.event-item {
  display: grid;
  gap: 5px;
  border: 1px solid #efdce8;
  border-radius: 8px;
  background: #fffafd;
  padding: 12px;
}

.event-item strong {
  color: #21182f;
  font-size: 14px;
}

.event-item span {
  color: #766b85;
  font-size: 12px;
  line-height: 1.4;
}

.mini-disclaimer {
  border-color: #ffd9a6;
  background: #fffaf1;
}

.mini-disclaimer p + p,
.disclaimer p + p {
  margin-top: 8px;
}

.me-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #ffffff 0, #fff1f7 100%);
}

.avatar-bubble {
  display: grid;
  width: 68px;
  aspect-ratio: 1 / 1;
  place-items: center;
  border: 1px solid #ffbfd0;
  border-radius: 8px;
  background: #ffeaf2;
  color: #d94673;
  font-size: 24px;
  font-weight: 900;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.55);
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.plan-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border-color: #f0cbd8;
  background: #fffafd;
  text-align: left;
}

.plan-button strong {
  color: #21182f;
  font-size: 15px;
}

.plan-button span {
  color: #766b85;
  font-size: 13px;
}

.plan-button.active {
  border-color: #ff8fab;
  background: #fff1f7;
  box-shadow: 0 0 0 4px rgba(255, 143, 171, 0.12);
}

.me-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.me-stats article {
  display: grid;
  gap: 8px;
  min-height: 78px;
  border: 1px solid #efdce8;
  border-radius: 8px;
  background: #fffafd;
  padding: 12px;
}

.me-stats span {
  color: #766b85;
  font-size: 13px;
}

.me-stats strong {
  min-width: 0;
  color: #21182f;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.mini-toast {
  position: fixed;
  left: 50%;
  bottom: calc(134px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(360px, calc(100vw - 48px));
  transform: translateX(-50%) translateY(10px);
  border-radius: 999px;
  background: rgba(43, 36, 54, 0.9);
  color: #ffffff;
  padding: 9px 14px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mini-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sticky-action {
  position: fixed;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  left: 0;
  z-index: 20;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(246, 200, 221, 0.7);
  backdrop-filter: blur(14px);
}

.mini-body[data-view="me"] .sticky-action {
  display: none;
}

.sticky-action button {
  display: block;
  width: min(406px, 100%);
  margin: 0 auto;
  animation: buttonBreath 2.2s ease-in-out infinite;
}

.mini-tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 21;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(246, 200, 221, 0.82);
  backdrop-filter: blur(14px);
}

.tab-button {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: #766b85;
  font-size: 13px;
  font-weight: 900;
}

.tab-button.active {
  border-color: #ffbfd0;
  background: #fff1f7;
  color: #d94673;
}

.tab-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  border-radius: 4px;
  vertical-align: -2px;
}

.home-icon {
  background: linear-gradient(135deg, #ff8fab, #ffd166);
}

.me-icon {
  background: linear-gradient(135deg, #9be7e5, #ff9ebb);
}

button {
  min-height: 46px;
  border: 1px solid #f0cbd8;
  border-radius: 8px;
  background: #ffffff;
  color: #2b2436;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  background: #fffafd;
}

button.primary {
  border-color: #ff7a9a;
  background: linear-gradient(90deg, #ff7a9a, #ffb36b);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(255, 122, 154, 0.26);
}

.app-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px 14px 32px;
}

.admin-shell {
  width: min(780px, 100%);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 12px;
}

.app-header h1 {
  color: #101828;
  font-size: 27px;
  line-height: 1.18;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 78px;
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  padding: 7px 12px;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(20, 27, 40, 0.08);
}

.status-pill.ok {
  background: #e5f6ed;
  color: #087443;
}

.status-pill.bad {
  background: #fff1f0;
  color: #b42318;
}

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

.three-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-actions {
  grid-template-columns: 1fr 1fr;
  align-self: end;
}

.split-title {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.small-button {
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.schedule-row {
  margin-top: 12px;
  align-items: end;
}

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

.admin-suit-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px;
}

.monitor-list .admin-suit-item {
  grid-template-columns: 52px minmax(0, 1fr) auto;
}

.admin-suit-item.text-only {
  grid-template-columns: 1fr;
}

.preview-image {
  display: block;
  min-height: 0;
  width: 52px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: #eef2f6;
}

.preview-image:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(43, 36, 54, 0.12);
}

.admin-suit-item img,
.preview-image img {
  display: block;
  width: 52px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.admin-suit-item div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-suit-item strong,
.admin-suit-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-suit-item strong {
  color: #17202a;
  font-size: 14px;
}

.admin-suit-item span {
  color: #667085;
  font-size: 12px;
}

.delta-chart,
.delta-list {
  display: grid;
  gap: 10px;
}

.delta-bar,
.delta-row {
  display: grid;
  gap: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.delta-bar strong,
.delta-row strong {
  color: #17202a;
  font-size: 13px;
}

.delta-bar span,
.delta-row span {
  color: #667085;
  font-size: 12px;
}

.delta-bar i {
  display: block;
  height: 9px;
  border-radius: 999px;
}

.delta-bar .total {
  background: linear-gradient(90deg, #22a6b3, #9be7e5);
}

.delta-bar .gifted {
  background: linear-gradient(90deg, #ff7a90, #ffd166);
}

.delta-list {
  margin-top: 12px;
}

.debug-card {
  padding: 0;
  overflow: hidden;
}

details {
  padding: 14px 16px 16px;
}

summary {
  cursor: pointer;
  color: #344054;
  font-weight: 700;
}

pre {
  min-height: 180px;
  margin: 12px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 7px;
  background: #101828;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.55;
}

.modal-open {
  overflow: hidden;
}

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(17, 24, 39, 0.58);
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid rgba(246, 200, 221, 0.9);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 24px 60px rgba(43, 36, 54, 0.28);
}

.image-modal-panel img {
  display: block;
  width: 100%;
  max-height: 66vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff7fb;
}

.image-modal-panel h2 {
  margin-top: 12px;
  color: #21182f;
  font-size: 18px;
  line-height: 1.25;
}

.image-modal-panel p {
  margin-top: 5px;
  color: #766b85;
  font-size: 13px;
  line-height: 1.5;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  min-height: 36px;
  margin-bottom: 8px;
  padding: 7px 10px;
  background: #ffffff;
}

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

@keyframes floatSoft {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.55;
    transform: rotate(45deg) scale(0.86);
  }
  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.12);
  }
}

@keyframes buttonBreath {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@media (max-width: 390px) {
  .mini-app {
    padding-right: 10px;
    padding-left: 10px;
  }

  .mini-hero h1 {
    font-size: 36px;
  }

  .product-panel {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .product-cover,
  .product-cover img {
    width: 104px;
  }

  .product-info h2 {
    font-size: 20px;
  }

  .field-row,
  .actions,
  .three-actions,
  .compact-actions,
  .split-title {
    grid-template-columns: 1fr;
  }

  .stat strong {
    font-size: 23px;
  }
}

@media (max-width: 360px) {
  .stats-grid,
  .me-stats,
  .admin-suit-list {
    grid-template-columns: 1fr;
  }
}
