:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #17212b;
  --ink-2: #37434f;
  --muted: #6b7885;
  --line: #dde4e8;
  --line-strong: #c7d1d7;
  --brand: #0c8f6c;
  --brand-dark: #0a7458;
  --brand-soft: #e2f4ed;
  --accent: #2f6fed;
  --accent-soft: #e8effc;
  --warn: #b26a00;
  --warn-soft: #fbf0dc;
  --danger: #cf343c;
  --danger-soft: #fdebed;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.05), 0 4px 16px rgba(23, 33, 43, 0.06);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

svg {
  flex-shrink: 0;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.mono {
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.strong {
  font-weight: 700;
}

.link {
  font-weight: 600;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.icon {
  width: 18px;
  height: 18px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.btn-danger {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--danger);
}

.btn-danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.btn-lg {
  padding: 11px 18px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ---------- badges & chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-muted {
  background: #eef1f3;
  color: var(--muted);
}

.badge-soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
}

.chip:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  text-decoration: none;
}

.chip-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---------- header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 440px;
  margin-left: auto;
}

.header-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  margin-left: 10px;
}

.header-search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface-soft);
  outline: none;
}

.header-search input:focus {
  border-color: var(--brand);
  background: var(--surface);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
}

.nav-link:hover {
  color: var(--brand-dark);
}

.nav-user {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.page-main {
  padding-top: 26px;
  padding-bottom: 48px;
  min-height: calc(100vh - 150px);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}

/* ---------- flashes ---------- */

.flash-stack {
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 14px;
  font-size: 14px;
}

.flash-success {
  border-color: #a9dcc8;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.flash-error {
  border-color: #f0b7bb;
  background: var(--danger-soft);
  color: var(--danger);
}

.flash-warning {
  border-color: #ecd39b;
  background: var(--warn-soft);
  color: var(--warn);
}

/* ---------- hero & sections ---------- */

.hero-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0;
  line-height: 1.35;
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
}

.hero-stats {
  display: flex;
  gap: 18px;
}

.hero-stat {
  min-width: 84px;
  text-align: center;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.hero-stat strong {
  display: block;
  font-size: 24px;
  color: var(--brand-dark);
}

.hero-stat span {
  font-size: 12px;
  color: var(--muted);
}

.hero-band-small {
  padding: 20px 26px;
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 26px;
}

.section-head {
  margin: 26px 0 16px;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

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

.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- product grid ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.product-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.product-cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.product-cover svg {
  width: 64px;
  height: 64px;
  color: #fff;
}

.cover-game {
  background: #1f7a5b;
}

.cover-software {
  background: #2f6fed;
}

.cover-membership {
  background: #b26a00;
}

.cover-api {
  background: #6b4d9e;
}

.cover-default {
  background: #3f6f8f;
}

.cover-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  flex: 1;
}

.product-body h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.product-body h3 a {
  color: var(--ink);
}

.product-body h3 a:hover {
  color: var(--brand-dark);
}

.product-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.price {
  color: var(--danger);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0;
}

del {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.stock {
  font-size: 12px;
  font-weight: 600;
}

.stock-ok {
  color: var(--brand-dark);
}

.stock-empty {
  color: var(--danger);
}

/* ---------- product detail ---------- */

.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 440px) 1fr;
  gap: 24px;
  align-items: start;
}

.detail-media {
  display: grid;
  gap: 16px;
}

.detail-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-cover svg {
  width: 120px;
  height: 120px;
  color: #fff;
}

.notice-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.notice-box strong {
  font-size: 14px;
}

.notice-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.notice-box-plain p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.detail-title h1 {
  margin: 10px 0 0;
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.4;
}

.detail-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 8px;
}

.detail-price .price {
  font-size: 30px;
}

.detail-meta {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.buy-panel {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.form-row input,
.form-row select,
.form-row textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--surface);
  outline: none;
  width: 100%;
  color: var(--ink);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 143, 108, 0.12);
}

.form-row textarea {
  resize: vertical;
  min-height: 90px;
}

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

.stepper {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.stepper input {
  width: 60px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.step-btn {
  width: 38px;
  height: 38px;
  border: 0;
  background: var(--surface-soft);
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
}

.step-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.gateway-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
}

.gateway-note svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-form {
  max-width: 860px;
}

.prose {
  color: var(--ink-2);
  line-height: 1.8;
  white-space: normal;
}

/* ---------- empty state ---------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state h1,
.empty-state h3 {
  color: var(--ink);
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 0 18px;
}

.empty-state .btn {
  margin: 0 6px;
}

.empty-inline {
  padding: 22px;
}

.empty-inline p {
  margin-bottom: 0;
}

/* ---------- auth ---------- */

.auth-wrap {
  display: flex;
  justify-content: center;
  padding: 36px 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.auth-card form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-alt {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- orders ---------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
  padding: 9px 12px;
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--surface-soft);
}

.cell-sub {
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}

.order-summary {
  margin-bottom: 18px;
}

.order-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.order-summary-head h1,
.order-summary-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.order-summary-head p {
  margin: 4px 0 0;
}

.order-badges {
  display: flex;
  gap: 8px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 24px;
  margin: 18px 0;
}

.kv-grid div {
  display: grid;
  gap: 2px;
}

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

.kv-grid dd {
  margin: 0;
  font-weight: 600;
}

.order-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.card-key-list {
  display: grid;
  gap: 10px;
}

.card-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.card-key pre {
  margin: 0;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

.success-hero {
  text-align: center;
  padding: 38px 20px 28px;
}

.success-hero svg {
  width: 56px;
  height: 56px;
  color: var(--brand);
}

.success-hero h1 {
  margin: 12px 0 6px;
  font-size: 26px;
  letter-spacing: 0;
}

.success-hero p {
  margin: 0;
  color: var(--muted);
}

.success-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

/* ---------- pay ---------- */

.pay-panel {
  max-width: 480px;
  margin: 20px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
  text-align: center;
}

.pay-panel h1 {
  margin: 10px 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.pay-panel > .muted {
  margin: 0 0 18px;
}

.pay-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.pay-icon svg {
  width: 28px;
  height: 28px;
}

.pay-info {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 18px;
  padding: 12px 16px;
  display: grid;
  gap: 8px;
}

.pay-info div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.pay-info dt {
  color: var(--muted);
  font-size: 13px;
}

.pay-info dd {
  margin: 0;
  font-weight: 600;
}

.pay-amount {
  color: var(--danger);
  font-size: 20px;
  font-weight: 800;
}

.pay-panel form {
  margin-bottom: 12px;
}

.pay-panel > .link {
  display: inline-block;
  margin-top: 8px;
}

.transfer-box {
  display: grid;
  gap: 10px;
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.transfer-box div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.transfer-box span {
  color: var(--muted);
  min-width: 62px;
}

.transfer-qr {
  width: 140px;
  height: 140px;
  object-fit: contain;
  margin: 6px auto 0;
  border-radius: var(--radius);
}

/* ---------- admin ---------- */

.admin-body {
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  background: #10242a;
  color: #d7e3e7;
  padding: 18px 14px;
  z-index: 60;
}

.admin-sidebar .brand {
  color: #fff;
  padding: 0 6px 16px;
}

.admin-nav {
  display: grid;
  gap: 4px;
  flex: 1;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #c4d3d8;
  font-size: 14px;
  font-weight: 600;
}

.admin-nav a svg {
  width: 18px;
  height: 18px;
}

.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.admin-nav a.active {
  background: var(--brand);
  color: #fff;
}

.admin-sidebar-foot {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-sidebar-foot .btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: #d7e3e7;
}

.admin-sidebar-foot .btn:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.admin-main {
  margin-left: 232px;
  min-height: 100vh;
  padding: 24px 28px 48px;
}

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

.admin-topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.admin-topbar p {
  margin: 4px 0 0;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.admin-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  max-width: 1240px;
  min-width: 0;
}

.admin-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.admin-columns-split {
  grid-template-columns: 320px 1fr;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

.stat-card strong {
  display: block;
  font-size: 26px;
  letter-spacing: 0;
  color: var(--ink);
  margin-top: 4px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
}

.tab-nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.tab-nav a:hover {
  color: var(--brand-dark);
  text-decoration: none;
}

.tab-nav a.tab-active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(23, 33, 43, 0.08);
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell .btn,
.actions-cell form {
  margin-right: 6px;
}

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

.form-row-full {
  grid-column: 1 / -1;
}

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

.sticky-actions {
  position: sticky;
  bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  justify-content: flex-end;
}

.category-edit {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface-soft);
}

.category-edit summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.category-edit summary em {
  font-style: normal;
  font-weight: 500;
}

.category-edit form {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.upload-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
  display: grid;
  gap: 8px;
}

.card-cell {
  margin: 0;
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 360px;
}

/* ---------- analytics ---------- */

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 220px;
  padding: 14px 8px 0;
}

.bar-col {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 6px;
  text-align: center;
}

.bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 150px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 2px;
  background: var(--brand);
  border-radius: 4px 4px 0 0;
}

.bar-day {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.bar-value {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- smart customer service ---------- */

.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(12, 143, 108, 0.32);
}

.chat-launcher:hover {
  background: var(--brand-dark);
}

.chat-launcher svg {
  width: 18px;
  height: 18px;
}

.chat-window {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 95;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(23, 33, 43, 0.18);
  overflow: hidden;
}

.chat-window[hidden] {
  display: none;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  background: var(--brand);
  color: #fff;
}

.chat-head strong {
  display: block;
  font-size: 15px;
}

.chat-head span {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}

.chat-head button {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 4px;
}

.chat-head button svg {
  width: 18px;
  height: 18px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-soft);
}

.chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--brand);
}

.chat-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.chat-form button svg {
  width: 17px;
  height: 17px;
}

/* ---------- receipt codes ---------- */

.receipt-options {
  display: grid;
  gap: 8px;
  text-align: left;
  margin-bottom: 14px;
}

.receipt-options-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.receipt-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--surface);
  cursor: pointer;
}

.receipt-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.receipt-option img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.receipt-option span {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.receipt-option small {
  color: var(--muted);
  font-size: 12px;
}

.receipt-chip {
  font-weight: 700;
  color: var(--brand-dark);
}

.code-thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  vertical-align: middle;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .header-search {
    order: 3;
    max-width: none;
    width: 100%;
  }

  .hero-band {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .hero-stats {
    justify-content: space-around;
  }

  .hero-stat {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }

  .admin-sidebar .brand {
    padding: 0;
  }

  .admin-nav {
    display: flex;
    flex: 1;
    overflow-x: auto;
  }

  .admin-nav a {
    white-space: nowrap;
  }

  .admin-sidebar-foot {
    border-top: 0;
    padding: 0;
    flex-direction: row;
  }

  .admin-main {
    margin-left: 0;
    padding: 18px 16px 40px;
  }

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

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

@media (max-width: 560px) {
  .site-footer .container {
    flex-direction: column;
    gap: 4px;
  }

  .product-grid,
  .product-grid-compact {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .product-body {
    padding: 11px;
  }

  .product-body h3 {
    font-size: 13.5px;
  }

  .price {
    font-size: 15px;
  }

  .btn {
    padding: 8px 11px;
  }

  .header-nav {
    gap: 8px;
  }

  .nav-user {
    display: none;
  }

  .hero-copy h1 {
    font-size: 21px;
  }

  .detail-title h1 {
    font-size: 20px;
  }

  .section-head-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
