:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #647169;
  --line: #e2e8e4;
  --surface: #ffffff;
  --canvas: #f5f7f6;
  --green: #087f4f;
  --green-dark: #075c3c;
  --green-soft: #e8f5ee;
  --orange: #ee6d2d;
  --orange-dark: #c94f16;
  --amber: #b87503;
  --red: #bc3126;
  --blue: #2368a0;
  --shadow: 0 14px 40px rgba(25, 54, 40, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.demo-ribbon {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 7px 16px;
  color: #fff;
  background: #202722;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
}

.topbar {
  position: sticky;
  top: 28px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  color: #fff;
  background: linear-gradient(110deg, var(--green-dark), var(--green));
  box-shadow: 0 5px 18px rgba(0, 60, 36, .18);
}
.topbar.store { background: linear-gradient(110deg, #d95216, var(--orange)); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 13px;
  background: rgba(255,255,255,.15);
  font-weight: 900;
}
.brand-copy strong { display: block; font-size: 16px; }
.brand-copy span { display: block; margin-top: 2px; opacity: .78; font-size: 12px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button {
  min-height: 44px;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.nav a:hover, .nav a.active, .nav button:hover { background: rgba(255,255,255,.16); }

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 28px;
  align-items: center;
  padding: 56px 0 40px;
}
.eyebrow { color: var(--green); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.store .eyebrow, .hero.storefront .eyebrow { color: var(--orange-dark); }
h1 { margin: 10px 0 14px; font-size: clamp(32px, 5vw, 56px); line-height: 1.04; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 16px; }
.lead { max-width: 720px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.hero-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-card .metric { margin-top: 18px; }

.grid { display: grid; gap: 18px; }
.grid.metrics { grid-template-columns: repeat(5, 1fr); margin-bottom: 24px; }
.grid.products { grid-template-columns: repeat(4, 1fr); padding-bottom: 64px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric, .panel, .product-card, .scenario-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(25, 54, 40, 0.04);
}
.metric { padding: 18px; }
.metric .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric .value { display: block; margin-top: 7px; font-size: 25px; font-weight: 900; }
.metric .hint { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 28px 0 18px; }
.section-head p { margin: 5px 0 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.input, .select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  font-size: 16px;
}
.input:focus, .select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,127,79,.12); }

.product-card { overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-visual {
  position: relative;
  display: grid;
  height: 190px;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--pack) 18%, white), #f4f5f4);
}
.product-visual::before {
  content: "";
  position: absolute;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--pack) 16%, transparent);
}
.pack {
  position: relative;
  display: grid;
  width: 78px;
  height: 128px;
  place-items: center;
  border: 5px solid rgba(255,255,255,.8);
  border-radius: 9px 9px 18px 18px;
  color: #fff;
  background: linear-gradient(100deg, color-mix(in srgb, var(--pack) 72%, #111), var(--pack), color-mix(in srgb, var(--pack) 68%, #fff));
  box-shadow: 12px 16px 24px rgba(0,0,0,.18);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  transform: rotate(2deg);
}
.pack::before { content: "★"; position: absolute; top: 12px; font-size: 17px; }
.pack span { width: 64px; margin-top: 22px; }
.demo-watermark { position: absolute; right: 10px; bottom: 8px; color: rgba(0,0,0,.35); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.product-body { padding: 16px; }
.product-title { min-height: 44px; line-height: 1.45; font-weight: 750; }
.product-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.price { margin-top: 13px; color: var(--orange-dark); font-size: 21px; font-weight: 900; }
.old-price { margin-left: 7px; color: #9aa39e; font-size: 12px; font-weight: 500; text-decoration: line-through; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  font-weight: 800;
}
.btn:hover { filter: brightness(.94); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn.orange { background: var(--orange); }
.btn.secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.btn.danger { background: var(--red); }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.btn.full { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: #edf1ef; color: #536159; font-size: 11px; font-weight: 850; }
.badge.green { background: var(--green-soft); color: var(--green-dark); }
.badge.orange { background: #fff0e8; color: var(--orange-dark); }
.badge.red { background: #fcecea; color: var(--red); }
.badge.amber { background: #fff5dc; color: var(--amber); }
.badge.blue { background: #eaf2fa; color: var(--blue); }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100dvh - 96px); }
.sidebar { padding: 24px 16px; border-right: 1px solid var(--line); background: #fff; }
.sidebar a { display: flex; min-height: 44px; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; color: var(--muted); font-weight: 750; }
.sidebar a:hover, .sidebar a.active { color: var(--green-dark); background: var(--green-soft); }
.main { min-width: 0; padding: 28px; }
.page-title { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title h1 { margin: 0; font-size: 30px; }
.page-title p { margin: 6px 0 0; color: var(--muted); }

.panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px; }
.table-wrap { overflow-x: auto; overscroll-behavior: contain; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 11px 13px; color: var(--muted); background: #f7f9f8; text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
td { padding: 13px; border-top: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #fbfcfb; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.subtle { color: var(--muted); font-size: 12px; }
.money { white-space: nowrap; font-weight: 800; }
.negative { color: var(--red); }
.positive { color: var(--green); }

.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.scenario-card { display: flex; min-height: 210px; flex-direction: column; padding: 18px; }
.scenario-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--green-soft); font-size: 20px; }
.scenario-card h3 { margin-top: 16px; }
.scenario-card p { flex: 1; color: var(--muted); line-height: 1.55; }
.event-list { display: grid; gap: 10px; }
.event-row { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.event-row .event-top { display: flex; justify-content: space-between; gap: 10px; }
.event-row pre { overflow-x: auto; margin: 9px 0 0; color: #4d5b53; font-size: 11px; white-space: pre-wrap; }

.login-shell { display: grid; min-height: calc(100dvh - 28px); place-items: center; padding: 24px; background: radial-gradient(circle at top left, #e6f3ec, #f7f8f7 55%); }
.login-card { width: min(430px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.login-card h1 { margin: 18px 0 8px; font-size: 30px; }
.field { display: grid; gap: 7px; margin-top: 18px; }
.field label { font-size: 12px; font-weight: 850; }
.notice { padding: 12px 14px; border: 1px solid #f2d59c; border-radius: 10px; color: #75500a; background: #fff8e7; line-height: 1.5; }
.error-box { display: none; margin-top: 14px; padding: 11px 13px; border-radius: 9px; color: var(--red); background: #fcecea; }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 12px;
  color: #fff;
  background: #202722;
  box-shadow: 0 15px 38px rgba(0,0,0,.2);
  transform: translateY(140%);
  transition: transform .22s ease;
}
.toast.show { transform: translateY(0); }
.toast.error { background: var(--red); }

.docs { padding: 42px 0 80px; }
.docs pre { overflow-x: auto; padding: 16px; border-radius: 12px; color: #d9f5e5; background: #14231b; }
.docs code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.docs .endpoint { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }

@media (max-width: 980px) {
  .grid.metrics { grid-template-columns: repeat(3, 1fr); }
  .grid.products { grid-template-columns: repeat(3, 1fr); }
  .scenario-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .shell { grid-template-columns: 74px minmax(0,1fr); }
  .sidebar a span { display: none; }
}

@media (max-width: 720px) {
  .demo-ribbon { position: static; }
  .topbar { position: sticky; top: 0; align-items: flex-start; padding-inline: 16px; }
  .brand-copy span { display: none; }
  .nav a { padding: 10px; font-size: 12px; }
  .nav .optional { display: none; }
  .container { width: min(100% - 28px, 1180px); }
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .grid.metrics, .grid.two, .grid.three { grid-template-columns: 1fr 1fr; }
  .grid.products { grid-template-columns: repeat(2, 1fr); }
  .shell { display: block; }
  .sidebar { position: sticky; top: 68px; z-index: 30; display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar a span { display: inline; white-space: nowrap; }
  .main { padding: 20px 14px 72px; }
  .page-title { display: block; }
  .page-title .toolbar { margin-top: 15px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .input, .select { font-size: 16px; }
  .btn.small { min-height: 44px; }
}

@media (max-width: 480px) {
  .brand-copy strong { font-size: 13px; }
  .nav a { padding-inline: 7px; }
  .grid.metrics, .grid.products, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .product-visual { height: 220px; }
  h1 { font-size: 34px; }
}
