:root {
  --font-sans: "Manrope", system-ui, sans-serif;
  --font-display: "Sora", system-ui, sans-serif;
  --background: oklch(0.975 0.008 230);
  --foreground: oklch(0.22 0.06 255);
  --card: oklch(1 0 0);
  --muted: oklch(0.95 0.012 230);
  --muted-foreground: oklch(0.5 0.04 250);
  --navy: oklch(0.25 0.08 258);
  --navy-foreground: oklch(0.97 0.01 230);
  --primary: oklch(0.32 0.11 258);
  --primary-foreground: oklch(0.98 0.005 230);
  --accent: oklch(0.68 0.13 180);
  --accent-foreground: oklch(0.99 0 0);
  --success: oklch(0.62 0.15 155);
  --destructive: oklch(0.58 0.22 27);
  --border: oklch(0.9 0.018 235);
  --input: oklch(0.9 0.018 235);
  --sidebar: oklch(0.25 0.08 258);
  --sidebar-foreground: oklch(0.97 0.01 230);
  --sidebar-primary: oklch(0.68 0.13 180);
  --sidebar-accent: oklch(0.32 0.09 258);
  --gradient-hero: linear-gradient(90deg, oklch(0.2 0.08 258 / 0.92) 0%, oklch(0.2 0.08 258 / 0.55) 45%, transparent 80%);
  --shadow-card: 0 10px 30px -15px oklch(0.25 0.08 258 / 0.35);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

body.lock { overflow: hidden; }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 700;
}

h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0; }

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

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg.icon { width: 1.25rem; height: 1.25rem; }
svg.icon-sm { width: 1rem; height: 1rem; }
svg.icon-xs { width: 0.75rem; height: 0.75rem; }
svg.icon-lg { width: 1.5rem; height: 1.5rem; }
svg.icon-xl { width: 3rem; height: 3rem; }
svg.icon-2xl { width: 2.5rem; height: 2.5rem; }
svg.spin { animation: spin 0.8s linear infinite; }

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

.container {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.page { padding-block: 1.5rem; }

.site-header { background: var(--navy); color: var(--navy-foreground); }

.header-inner,
.sidebar-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-inner {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
  justify-content: space-between;
  padding-block: 1rem;
}

.brand,
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}

.brand { font-size: 1.25rem; color: var(--navy-foreground); }
.auth-card .brand { color: var(--foreground); }
.sidebar-brand { font-size: 1.125rem; color: inherit; padding: 1.25rem; }
.brand svg, .sidebar-brand svg { color: var(--accent); }

.header-link {
  color: oklch(0.97 0.01 230 / 0.7);
  text-decoration: none;
  font-size: 0.875rem;
}

.header-link:hover { color: var(--navy-foreground); }

.site-footer {
  margin-top: 3rem;
  background: var(--navy);
  color: oklch(0.97 0.01 230 / 0.7);
  text-align: center;
  font-size: 0.875rem;
  padding: 1.5rem 1rem;
}

.footer-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.slider {
  position: relative;
  overflow: hidden;
  border-radius: 1.375rem;
  aspect-ratio: 16 / 9;
  background: var(--navy);
}

.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.slide.is-active {
  visibility: visible;
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.slide-overlay {
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
}

.slide-copy {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 1rem 2.5rem;
}

.slide-kicker {
  margin: 0 0 0.35rem;
  color: oklch(0.86 0.1 180);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slide-copy h2 {
  max-width: 18rem;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--navy-foreground);
}

.slide-copy p:not(.slide-kicker) {
  max-width: 34rem;
  margin-top: 0.35rem;
  color: oklch(0.97 0.01 230 / 0.9);
  font-size: 0.82rem;
  line-height: 1.5;
}

.slide-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  display: none;
  width: 4.6rem;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid oklch(0.98 0.01 230 / 0.22);
  border-radius: 1.15rem;
  background: oklch(0.98 0.01 230 / 0.12);
  padding: 0.75rem 0.35rem 0.65rem;
  color: var(--navy-foreground);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.slide-badge svg { width: 1.7rem; height: 1.7rem; }

.dots {
  position: absolute;
  z-index: 2;
  bottom: 1rem;
  left: 50%;
  display: flex;
  gap: 0.5rem;
  transform: translateX(-50%);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: oklch(0.97 0.01 230 / 0.6);
}

.dot.is-active { width: 2rem; background: var(--accent); }

.section-title { margin: 2.5rem 0 1rem; font-size: 1.5rem; }

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

.product-card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.125rem;
  box-shadow: var(--shadow-card);
}

.product-card {
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.product-card > img {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--muted);
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0.75rem;
}

.product-body h3 { line-height: 1.25; }

.price {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-size: 1.125rem;
  font-weight: 700;
}

.product-body .btn { margin-top: auto; }

.product-title { font-weight: 600; }
.price-inline { color: var(--primary); font-weight: 700; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.75rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; }

.btn {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover { opacity: 0.92; }
.btn:disabled { cursor: not-allowed; opacity: 0.6; }
.btn-accent { background: var(--accent); color: var(--accent-foreground); }
.btn-outline { border: 1px solid var(--border); background: transparent; color: var(--foreground); }
.btn-sm { min-height: 2rem; padding: 0.2rem 0.75rem; border-radius: 999px; font-size: 0.75rem; }
.btn-danger { border: 1px solid oklch(0.55 0.18 25 / 0.35); background: transparent; color: var(--destructive); }
.btn-block { width: 100%; }
.actions { display: flex; gap: 0.5rem; }
.actions .btn { flex: 1; }

.noscript-note { margin-top: 1rem; color: var(--muted-foreground); font-size: 0.875rem; }

.backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: oklch(0.2 0.05 258 / 0.55);
}

.dialog {
  position: relative;
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: auto;
  padding: 1.25rem;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.dialog.product-dialog {
  width: min(42rem, 100%);
  max-height: min(92vh, 48rem);
  padding: 1.35rem 1.35rem 1.2rem;
}

body.modal-open { overflow: hidden; }

.dialog h3 { margin: 0 1.75rem 1rem 0; font-size: 1.125rem; }

.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
}

.stack > * + *,
.stack-sm > * + * { margin-top: 0.75rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.stack > * + * { margin-top: 1rem; }

.mini { display: flex; align-items: center; gap: 0.75rem; }
.mini img { width: 3.5rem; height: 3.5rem; border-radius: 0.5rem; object-fit: cover; background: var(--muted); }

.pkg {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  background: var(--card);
  padding: 1rem;
  text-align: left;
}

.pkg .price { margin: 0; }
.pkg:hover { border-color: oklch(0.68 0.13 180 / 0.5); }
.pkg.is-selected { border-color: var(--accent); background: oklch(0.68 0.13 180 / 0.1); }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
}

input, select {
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid var(--input);
  border-radius: 0.75rem;
  background: var(--background);
  padding: 0.5rem 0.75rem;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.inline-link { color: var(--accent); font-weight: 600; }

.summary, .pay-box {
  border-radius: 0.75rem;
  background: var(--muted);
  padding: 0.75rem 1rem;
}

.summary { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; }
.summary.plain { background: transparent; padding: 0; }

.pay-box { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pay-box > svg { color: var(--accent); }
.amount { margin: 0; color: var(--primary); font-size: 1.5rem; font-weight: 700; }

.center { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.center > svg { color: var(--success); }

.receipt {
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.kv { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; }
.kv + .kv { margin-top: 0.5rem; }
.kv span:first-child { color: var(--muted-foreground); }
.kv span:last-child { font-weight: 500; text-align: right; }
.kv.bold span:last-child { color: var(--primary); font-weight: 700; }
.total { margin-top: 0.5rem; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.receipt-page { width: min(28rem, 100%); margin-inline: auto; padding: 1.25rem; }

.toast {
  position: fixed;
  z-index: 80;
  top: 1rem;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: white;
  font-size: 0.875rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.toast-err { background: var(--destructive); }
.toast-ok { background: var(--success); }

.admin-shell { min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-foreground); }
.sidebar-bar { display: flex; align-items: center; justify-content: space-between; }
.top-logout { margin: 0; padding-right: 0.35rem; }

.side-nav { display: none; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.15rem;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  padding: 0.35rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px oklch(0.2 0.05 258 / 0.18);
}

.bottom-link {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  border-radius: 0.65rem;
  padding: 0.3rem 0.1rem;
  color: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.bottom-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bottom-link.is-active { color: var(--sidebar-primary); }

.side-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}

.side-link:hover { background: oklch(0.32 0.09 258 / 0.6); }
.side-link.is-active { background: var(--sidebar-accent); color: var(--sidebar-primary); }
.side-logout { display: flex; margin: 0; }

.admin-main { min-width: 0; padding: 1rem 1rem calc(5.25rem + env(safe-area-inset-bottom)); }
.page-title { margin-bottom: 0; font-size: 1.5rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter {
  display: inline-flex;
  align-items: center;
  min-height: 2.15rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  padding: 0.25rem 0.8rem;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.filter.is-active { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
.panel { padding: 1.25rem; }
.setting-card { scroll-margin-top: 1rem; }
.setting-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.setting-head h3 { margin: 0; }
.setting-head p { margin: 0.15rem 0 0; }
.setting-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  place-items: center;
  border-radius: 0.75rem;
}
.setting-icon.site { background: oklch(0.32 0.11 258 / 0.12); color: var(--primary); }
.setting-icon.pay { background: oklch(0.68 0.13 180 / 0.16); color: oklch(0.45 0.1 180); }
.setting-icon.profile { background: oklch(0.62 0.15 155 / 0.16); color: var(--success); }
.stat-value { margin-top: 0.25rem; font-size: 1.5rem; font-weight: 700; }

.stats, .form-grid, .admin-products { display: grid; gap: 0.75rem; }
.stats { gap: 1rem; }

.bar { height: 0.5rem; margin-top: 0.25rem; overflow: hidden; border-radius: 999px; background: var(--muted); }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.pkg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.product-row { display: flex; gap: 0.85rem; padding: 0.9rem; }
.product-row.is-editing { outline: 2px solid var(--accent); outline-offset: -2px; }
.product-row.is-off { opacity: 0.72; }
.product-row img, .edit-preview { width: 5.25rem; height: 5.25rem; flex: none; border-radius: 0.75rem; object-fit: cover; background: var(--muted); }
.edit-preview { width: 4.25rem; height: 4.25rem; }
.pkg-lines { margin: 0.35rem 0 0; }
.card-actions { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.75rem; }
.card-actions form { flex: 1; margin: 0; }
.card-actions .btn { flex: 1; width: 100%; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.pkg-head { margin-bottom: 0.35rem; color: var(--muted-foreground); font-size: 0.75rem; font-weight: 600; }
.file-pick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 0.85rem;
  background: var(--background);
  padding: 0.7rem;
}
.file-pick input { background: transparent; }
.badge.is-off { background: var(--muted); color: var(--muted-foreground); }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.75rem;
  text-decoration: none;
  cursor: pointer;
}

.text-btn.danger { color: var(--destructive); }

.split { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.order-card { padding: 1rem; }
.order-card p { overflow-wrap: anywhere; }
.select-auto { width: auto; min-width: 11rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card); box-shadow: var(--shadow-card); }
table { width: 100%; min-width: 40rem; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.75rem; text-align: left; }
thead { background: var(--muted); }
tbody td { border-top: 1px solid var(--border); }
.empty { padding: 1.5rem; color: var(--muted-foreground); text-align: center; }

.badge {
  display: inline-block;
  border-radius: 999px;
  background: oklch(0.62 0.15 155 / 0.15);
  color: var(--success);
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.auth-screen, .forbidden, .not-found {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-screen { background: var(--navy); }

.auth-card {
  width: min(24rem, 100%);
  border-radius: 1.375rem;
  background: var(--card);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.linkish, .center-link {
  display: block;
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
}

.linkish { color: var(--muted-foreground); }
.center-link { color: var(--accent); }

.forbidden { gap: 1rem; text-align: center; }
.not-found { gap: 0.5rem; text-align: center; }
.not-found h1 { font-size: 4.5rem; }
.not-found h2 { font-size: 1.25rem; font-weight: 600; }
.not-found .btn { margin-top: 1rem; }

@media (min-width: 640px) {
  .slider { aspect-ratio: 16 / 6; }
  .slide-copy { justify-content: center; padding: 1.5rem 9rem 1.5rem 2.5rem; }
  .slide-copy h2 { max-width: 34rem; font-size: 2rem; }
  .slide-kicker { font-size: 0.8rem; }
  .slide-copy p:not(.slide-kicker) { font-size: 0.95rem; }
  .slide-badge { display: flex; top: 1.25rem; right: 1.5rem; bottom: auto; width: 5.5rem; }
  .slide-badge svg { width: 2.4rem; height: 2.4rem; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .admin-shell { display: flex; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar { width: 15rem; flex: none; min-height: 100vh; }
  .sidebar-bar { display: block; }
  .top-logout, .bottom-nav { display: none; }
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: visible;
    padding: 0 0.75rem 1rem;
  }
  .side-link, .side-logout { width: 100%; }
  .side-logout { display: block; margin-top: 1.5rem; }
  .admin-main { padding: 2rem; }
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
  svg.spin { animation: none; }
}

@media print {
  body * { visibility: hidden; }
  .receipt.is-print, .receipt.is-print * { visibility: visible; }
  .receipt.is-print {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
  }
}
