:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #172337;
  --muted: #6c7a90;
  --line: #e5eaf2;
  --brand: #5750ec;
  --soft: #eeedff;
  --green: #14856b;
  --red: #c33c55;
}
html.theme-switching #app { visibility: hidden; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
a {
  color: var(--brand);
  text-decoration: none;
}
button,
.button {
  border: 0;
  border-radius: 9px;
  padding: 10px 18px;
  color: white;
  background: var(--brand);
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  white-space: nowrap;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.secondary {
  background: var(--soft);
  color: var(--brand);
}
.danger {
  background: #fff0f2;
  color: var(--red);
}
.small {
  padding: 5px 10px;
  font-size: 12px;
}
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dce2ec;
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
input[type="checkbox"] {
  width: auto;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
label {
  display: block;
  color: #506078;
  font-size: 13px;
  margin-bottom: 14px;
}
label span {
  display: block;
  margin-bottom: 5px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.6px;
  margin-bottom: 5px;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  color: var(--ink);
  font-weight: 750;
}
.brand-icon {
  background: var(--brand);
  border-radius: 12px;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 17px;
}
.topbar {
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 17px max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar nav {
  display: flex;
  gap: 22px;
  align-items: center;
}
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 3px 8px #17233703;
}
.hero {
  background: linear-gradient(115deg, #f0efff, #e9f3ff);
  border: 1px solid #e2e5ff;
  border-radius: 18px;
  padding: 38px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.hero:after {
  content: "✳";
  position: absolute;
  right: 60px;
  top: -65px;
  font-size: 240px;
  opacity: 0.07;
  color: var(--brand);
}
.hero h1 {
  font-size: 36px;
}
.hero p {
  margin: 12px 0 0;
  max-width: 700px;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar input {
  max-width: 300px;
}
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.tab {
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
}
.tab.active {
  background: var(--brand);
  color: white;
}
.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.product {
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s;
}
.product:hover {
  transform: translateY(-3px);
}
.product-image {
  height: 145px;
  background: linear-gradient(130deg, #f0efff, #e2f2f7);
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 42px;
  overflow: hidden;
}
.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-info {
  padding: 22px;
}
.product-title {
  font-size: 17px;
  margin: 10px 0;
}
.product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
}
.price {
  font-size: 23px;
  font-weight: 750;
  color: var(--brand);
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand);
  font-size: 11px;
}
.badge.green {
  background: #eaf7f1;
  color: var(--green);
}
.badge.red {
  background: #fff0f2;
  color: var(--red);
}
.admin {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: white;
  border-right: 1px solid var(--line);
  padding: 25px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  padding: 0 7px 25px;
  font-size: 16px;
  white-space: nowrap;
  gap: 7px;
}
.nav-label {
  font-size: 10px;
  color: #99a3b5;
  letter-spacing: 2px;
  padding: 20px 13px 7px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  color: #65728a;
  border-radius: 8px;
  margin: 3px 0;
}
.nav-link.active {
  background: var(--soft);
  color: var(--brand);
  font-weight: 650;
}
.nav-icon {
  font-size: 14px;
  width: 18px;
}
.workspace {
  min-width: 0;
}
.adminbar {
  padding: 18px 32px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-content {
  padding: 30px 32px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat .value {
  font-size: 27px;
  font-weight: 750;
  margin-top: 12px;
}
.stat .muted {
  font-size: 12px;
}
.stat .symbol {
  float: right;
  background: var(--soft);
  color: var(--brand);
  padding: 5px 10px;
  border-radius: 8px;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  text-align: left;
}
th {
  font-size: 12px;
  color: var(--muted);
  background: #fafbfe;
  font-weight: 600;
}
td,
th {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
}
td {
  font-size: 13px;
}
td.actions {
  overflow: visible;
  max-width: none;
  display: flex;
  gap: 6px;
}
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}
.empty {
  padding: 45px;
  text-align: center;
  color: var(--muted);
}
.login {
  max-width: 450px;
  margin: 9vh auto;
  padding: 34px;
}
.login .brand {
  margin-bottom: 35px;
}
.login h1 {
  font-size: 25px;
}
.login button {
  width: 100%;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  width: min(760px, 95vw);
  max-height: 90vh;
  color: var(--ink);
  box-shadow: 0 25px 100px #17233733;
}
dialog::backdrop {
  background: #17233766;
  backdrop-filter: blur(3px);
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.dialog-header h2 {
  margin: 0;
}
.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.error {
  color: var(--red);
  font-size: 13px;
}
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 25px;
}
.detail pre,
.secret {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: #f8f9fc;
  padding: 18px;
  border-radius: 8px;
  font:
    13px/1.8 ui-monospace,
    monospace;
}
.detail-image {
  height: 240px;
  border-radius: 10px;
  margin-bottom: 24px;
}
.total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding-top: 20px;
}
.chart-column {
  flex: 1;
  text-align: center;
  min-width: 0;
  font-size: 10px;
  color: var(--muted);
}
.chart-bar {
  min-height: 3px;
  background: linear-gradient(#8c87ff, var(--brand));
  border-radius: 5px 5px 0 0;
  margin-bottom: 7px;
}
.notice {
  background: #f0efff;
  color: #585486;
  border-radius: 9px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.account-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.spacer {
  flex: 1;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #172337;
  color: white;
  border-radius: 10px;
  padding: 13px 23px;
  box-shadow: 0 5px 30px #17233730;
  display: none;
  z-index: 99;
  max-width: 90vw;
}
.loading {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
.preview-image {
  max-width: 100%;
  max-height: 350px;
}
.code {
  font:
    12px ui-monospace,
    monospace;
}
.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.detail-list {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.detail-list dt {
  color: var(--muted);
}
.detail-list dd {
  margin: 0;
}
.error-page {
  max-width: 650px;
  margin: 10vh auto;
}
footer {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 1000px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin {
    grid-template-columns: 185px 1fr;
  }
  .admin-content {
    padding: 24px 20px;
  }
  .detail {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .products {
    grid-template-columns: 1fr;
  }
  .page {
    padding: 22px 16px;
  }
  .hero {
    padding: 24px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .topbar {
    padding: 15px 16px;
    flex-wrap: wrap;
  }
  .topbar nav {
    gap: 14px;
    font-size: 12px;
  }
  .admin {
    display: block;
  }
  .sidebar {
    position: relative;
    height: auto;
    padding: 15px;
    display: flex;
    gap: 5px;
    overflow: auto;
    align-items: center;
    white-space: nowrap;
  }
  .sidebar .brand {
    padding: 0 12px 0 0;
    font-size: 14px;
  }
  .sidebar .brand-icon {
    display: none;
  }
  .nav-label {
    display: none;
  }
  .nav-link {
    padding: 7px 10px;
    display: inline-flex;
  }
  .nav-icon {
    display: none;
  }
  .adminbar {
    padding: 15px 18px;
  }
  .admin-content {
    padding: 22px 14px;
  }
  .heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 16px;
  }
  .stat .value {
    font-size: 23px;
  }
  .account-grid {
    grid-template-columns: 1fr;
  }
  .account-nav {
    display: flex;
    overflow: auto;
    gap: 8px;
    padding: 10px;
  }
  .account-nav .nav-link {
    white-space: nowrap;
  }
  .login {
    margin: 5vh 15px;
  }
  .chart {
    gap: 3px;
  }
  .chart-column:nth-child(even) span {
    visibility: hidden;
  }
}
