:root {
  --ink: #0a0d12;
  --muted: #68707d;
  --line: #d6d9df;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --dark: #05070b;
  --navy: #071b3a;
  --navy-light: #123c73;
  --accent: #071b3a;
  --accent-dark: #05070b;
  --warning: #8a8f98;
  --danger: #3f4652;
  --blue: #123c73;
  --shadow: 0 18px 45px rgba(5, 7, 11, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--dark);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-lockup strong,
.brand-lockup span,
.member-chip span,
.member-chip small {
  display: block;
}

.brand-lockup span,
.member-chip span,
.member-chip small {
  color: #b8c4d5;
  font-size: 0.84rem;
}

.brand-mark {
  width: 48px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.82rem;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  color: #d9e4f1;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--navy-light);
  font-size: 0.78rem;
  font-weight: 800;
}

.member-chip {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.member-chip strong {
  display: block;
  margin: 6px 0;
}

main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h1,
.section-heading h2,
.shop-hero h2,
.panel h2,
.member-profile h2,
.drawer-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions,
.product-actions,
.drawer-header,
.cart-summary > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.cart-button,
.primary-action,
.secondary-action,
.segment,
.status-select {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 42px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.cart-button,
.primary-action,
.secondary-action {
  padding: 0 16px;
  font-weight: 800;
}

.cart-button {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-button strong {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 0.82rem;
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--navy-light);
}

.secondary-action:hover,
.icon-button:hover,
.cart-button:hover,
.segment:hover {
  border-color: #aab8ca;
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 24px;
}

.shop-hero {
  position: relative;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
  background: #111827;
  box-shadow: var(--shadow);
}

.shop-hero img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
}

.shop-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 7, 11, 0.82), rgba(7, 27, 58, 0.12));
}

.shop-hero-content {
  position: absolute;
  inset: auto auto 32px 32px;
  z-index: 1;
  max-width: min(580px, calc(100% - 64px));
  color: #ffffff;
}

.shop-hero-content p {
  margin: 0 0 8px;
  color: #dbe4f0;
  font-weight: 800;
}

.shop-hero h2 {
  margin-bottom: 18px;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.02;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f8;
}

.segment {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
}

.segment.active {
  background: var(--surface);
  border-color: var(--surface);
  box-shadow: 0 4px 10px rgba(17, 24, 39, 0.08);
}

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

.product-card,
.metric-card,
.panel,
.member-profile,
.cart-line,
.reward-card,
.admin-order-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.product-card {
  overflow: hidden;
}

.product-art {
  height: 158px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 3.2rem;
  font-weight: 800;
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-body h3,
.product-body p {
  margin: 0;
}

.product-body p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.product-meta,
.order-meta,
.reward-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-weight: 800;
  font-size: 1.1rem;
}

.stock {
  color: var(--muted);
  font-size: 0.84rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 2rem;
}

.panel {
  padding: 18px;
}

.compact {
  margin-bottom: 16px;
}

.order-list,
.reward-list,
.admin-order-table,
.cart-items {
  display: grid;
  gap: 12px;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 160px 140px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.order-row:last-child {
  border-bottom: 0;
}

.order-row h3,
.reward-card h3,
.cart-line h3,
.admin-order-row h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.order-row p,
.cart-line p,
.admin-order-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #164f98;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.completed {
  background: #ddfbe9;
  color: #066241;
}

.badge.pending,
.badge.packing {
  background: #fff3d7;
  color: #8a5700;
}

.badge.cancelled {
  background: #ffe1e6;
  color: #9d1d32;
}

.member-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

.member-profile {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 22px;
  background: var(--dark);
  color: #ffffff;
}

.member-profile .eyebrow {
  color: #dbe4f0;
}

.member-profile p {
  margin: 0;
  color: #cbd5e1;
}

.points-ring {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: center;
  margin-top: 14px;
  background: conic-gradient(var(--accent) 0 74%, rgba(255, 255, 255, 0.12) 74% 100%);
  position: relative;
}

.points-ring::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--dark);
}

.points-ring span,
.points-ring small {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
}

.points-ring span {
  transform: translateY(-12px);
  font-size: 2rem;
  font-weight: 800;
}

.points-ring small {
  transform: translateY(20px);
  color: #b8c4d5;
}

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

.reward-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.reward-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-label {
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  background: #e4ebf4;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy), #8c95a3);
  transition: width 240ms ease;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
}

.admin-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
}

.admin-order-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 110px 170px;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.status-select {
  padding: 0 10px;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(440px, 100%);
  height: 100vh;
  padding: 22px;
  background: #ffffff;
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 220ms ease;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: 16px;
}

.cart-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  justify-content: space-between;
}

.cart-items {
  align-content: start;
  overflow: auto;
  padding-right: 4px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-controls button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-weight: 800;
}

.cart-summary {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.cart-summary > div {
  justify-content: space-between;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  transform: translate(-50%, 20px);
  opacity: 0;
  max-width: calc(100% - 32px);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--dark);
  color: #ffffff;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@media (max-width: 1120px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reward-list {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    gap: 14px;
  }

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

  .nav-item {
    justify-content: center;
    padding: 10px 6px;
  }

  .nav-icon,
  .member-chip {
    display: none;
  }

  main {
    padding: 18px;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .metrics-grid,
  .member-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .shop-hero,
  .shop-hero img {
    min-height: 390px;
  }

  .shop-hero::after {
    background: linear-gradient(0deg, rgba(10, 18, 29, 0.8), rgba(10, 18, 29, 0.14));
  }

  .shop-hero-content {
    left: 20px;
    right: 20px;
    bottom: 22px;
    max-width: none;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }
}
