:root {
  --ink: #18212f;
  --muted: #667085;
  --line: #dde4ee;
  --soft: #f5f7fb;
  --paper: #ffffff;
  --brand: #0f9f6e;
  --brand-dark: #087455;
  --coral: #ef6f54;
  --gold: #d5962f;
  --blue: #2f6fed;
  --danger: #d64545;
  --shadow: 0 18px 48px rgba(18, 35, 66, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf2f7;
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e9f7f1;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.warn {
  background: #fff4dd;
  color: #946018;
}

.pill.danger {
  background: #ffe7e3;
  color: #b33c28;
}

.pill.blue {
  background: #e9f0ff;
  color: #2453b3;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(15, 159, 110, 0.2);
}

.btn.secondary {
  background: #edf2f7;
  color: var(--ink);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--brand-dark);
  box-shadow: none;
  border: 1px solid #bfe3d3;
}

.btn.danger {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(214, 69, 69, 0.16);
}

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

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
  outline: none;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 159, 110, 0.12);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #101828;
  color: white;
  box-shadow: var(--shadow);
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

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

.app-shell {
  display: grid;
  place-items: start center;
  min-height: 100vh;
  padding: 18px;
}

.phone {
  position: relative;
  width: min(430px, 100%);
  min-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid #d2dbe6;
  border-radius: 28px;
  background: #f7fafc;
  box-shadow: var(--shadow);
}

.phone::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  z-index: 3;
  width: 92px;
  height: 6px;
  border-radius: 999px;
  background: #c9d2df;
  transform: translateX(-50%);
}

.mini-main {
  height: calc(100vh - 36px);
  min-height: 720px;
  overflow: auto;
  padding: 20px 14px 92px;
}

.mini-hero {
  position: relative;
  min-height: 208px;
  padding: 36px 18px 18px;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  background:
    linear-gradient(120deg, rgba(13, 128, 93, 0.94), rgba(40, 110, 181, 0.82)),
    url("https://images.unsplash.com/photo-1516321497487-e288fb19713f?auto=format&fit=crop&w=1000&q=80");
  background-size: cover;
  background-position: center;
  color: white;
}

.mini-hero h1 {
  max-width: 260px;
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.mini-hero p {
  max-width: 300px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.hero-actions .btn {
  min-height: 38px;
  background: white;
  color: var(--brand-dark);
  box-shadow: none;
}

.hero-actions .btn.secondary {
  background: rgba(255, 255, 255, 0.16);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #101828;
  color: white;
  font-size: 13px;
  font-weight: 900;
}

.profile-chip strong {
  display: block;
  line-height: 1.1;
}

.profile-chip small {
  color: rgba(255, 255, 255, 0.72);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: -28px 12px 14px;
  position: relative;
  z-index: 4;
}

.quick-stats button,
.quick-stats a {
  min-width: 0;
  min-height: 70px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(26, 43, 71, 0.08);
}

.quick-stats svg {
  display: block;
  margin: 0 auto 5px;
  color: var(--brand);
}

.quick-stats span {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
}

.section {
  margin: 16px 0 0;
}

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

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

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.category-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 0 8px;
}

.category-row button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 800;
}

.category-row button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

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

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.product-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.86;
  object-fit: cover;
}

.product-card .body {
  padding: 10px;
}

.product-card h3 {
  min-height: 40px;
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
}

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

.price {
  color: var(--coral);
  font-size: 18px;
  font-weight: 900;
}

.product-card .btn {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

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

.summary-tile {
  min-height: 86px;
  padding: 14px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px solid var(--line);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

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

.list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.list-item h3 {
  margin: 0;
  font-size: 15px;
}

.list-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-tabs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.mini-tabs button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 64px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-tabs button.active {
  color: var(--brand-dark);
}

.mini-view {
  display: none;
}

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

.detail-drawer,
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.modal-layer.center {
  align-items: center;
}

.detail-drawer.open,
.modal-layer.open {
  display: flex;
}

.drawer-card,
.modal-card {
  width: min(430px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow);
}

.drawer-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.drawer-body,
.modal-body {
  padding: 16px;
}

.drawer-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.22;
}

.icon-btn {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.buy-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.poster {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e1f2b;
  color: white;
}

.poster img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.poster-body {
  padding: 16px;
}

.poster-body h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.poster-bottom {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.mock-qr {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 6px solid white;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #111 10px, transparent 10px) 0 0 / 20px 20px,
    linear-gradient(#111 10px, transparent 10px) 0 0 / 20px 20px,
    #fff;
  color: #111;
  font-size: 11px;
  font-weight: 900;
}

.admin-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
  background: #f4f6f9;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #101828;
  color: white;
}

.admin-brand {
  display: grid;
  gap: 4px;
  margin-bottom: 26px;
}

.admin-brand strong {
  font-size: 18px;
}

.admin-brand span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.admin-nav {
  display: grid;
  gap: 6px;
}

.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  font-weight: 800;
}

.admin-nav button.active,
.admin-nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

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

.admin-topbar h1 {
  margin: 0;
  font-size: 26px;
}

.admin-topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-view {
  display: none;
}

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

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

.metric {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

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

.card-head h2 {
  margin: 0;
  font-size: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

.thumb {
  width: 54px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: #edf2f7;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions .btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.drawer-footer,
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px 16px;
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

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

  .metric-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 0;
  }

  .phone {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .mini-main {
    height: 100vh;
  }

  .product-grid,
  .summary-grid,
  .buy-panel,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-main {
    padding: 16px;
  }

  .admin-nav {
    grid-template-columns: 1fr 1fr;
  }
}
