:root {
  --ink: #12151c;
  --muted: #5c6578;
  --paper: #f4f1eb;
  --surface: #ffffff;
  --line: #e4dfd6;
  --accent: #0f766e;
  --accent-dark: #0b5a54;
  --accent-soft: #d8f3ef;
  --danger: #b42318;
  --warning: #b54708;
  --info: #175cd3;
  --success: #027a48;
  --shadow: 0 18px 40px rgba(18, 21, 28, 0.08);
  --radius: 18px;
  --font: "Figtree", sans-serif;
  --display: "Bricolage Grotesque", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32%),
    linear-gradient(180deg, #faf8f4 0%, var(--paper) 45%, #efebe3 100%);
  min-height: 100vh;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
ul { margin: 0; padding-left: 1.1rem; }

.container { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.narrow { width: min(520px, calc(100% - 2rem)); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 36rem; }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(244, 241, 235, 0.86);
  border-bottom: 1px solid rgba(228, 223, 214, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
}

.brand-mark {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.35rem;
  background: linear-gradient(135deg, var(--accent), #134e4a 70%);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--ink);
  font-weight: 550;
  text-decoration: none;
}

.main-nav a:hover { color: var(--accent); }

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.cart-count {
  min-width: 1.4rem;
  height: 1.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.site-main { padding-bottom: 3rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-danger { background: #fef3f2; color: var(--danger); border-color: #fecdca; }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.9rem; }
.btn-block { width: 100%; }

.hero {
  padding: 3.5rem 0 2rem;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
  min-height: min(68vh, 560px);
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  max-width: 10ch;
  margin-bottom: 1rem;
  animation: rise 0.7s ease both;
}

.hero-copy .lead { animation: rise 0.7s ease 0.08s both; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  animation: rise 0.7s ease 0.16s both;
}

.hero-visual {
  position: relative;
  min-height: 320px;
  animation: floatIn 0.9s ease both;
}

.hero-orb {
  position: absolute;
  inset: 10% 8% auto auto;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 40% 60% 55% 45%;
  background:
    linear-gradient(160deg, rgba(15, 118, 110, 0.9), rgba(19, 78, 74, 0.75)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  filter: saturate(1.05);
  animation: morph 8s ease-in-out infinite;
}

.hero-panel {
  position: absolute;
  left: 8%;
  bottom: 12%;
  width: min(260px, 70%);
  padding: 1.25rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.25rem;
}

.hero-panel span { color: var(--muted); font-size: 0.85rem; }
.hero-panel strong { font-family: var(--display); font-size: 1.4rem; }
.hero-panel em { font-style: normal; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

.section { padding: 2.75rem 0; }
.section-alt {
  background: rgba(255, 255, 255, 0.45);
  border-block: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head p { margin: 0; color: var(--muted); }

.page-hero {
  padding: 2.2rem 0 0.5rem;
}

.page-hero h1 { font-size: clamp(2rem, 4vw, 2.8rem); }

.category-grid,
.product-grid,
.stats-grid {
  display: grid;
  gap: 1rem;
}

.category-grid { grid-template-columns: repeat(4, 1fr); }
.product-grid { grid-template-columns: repeat(4, 1fr); }

.category-tile {
  display: block;
  padding: 1.4rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.category-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #cfe8e4;
  text-decoration: none;
}

.category-tile h3 { margin-bottom: 0.35rem; }
.category-tile p { margin: 0; color: var(--muted); font-size: 0.95rem; }

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

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

.product-media {
  position: relative;
  aspect-ratio: 1 / 1.05;
  background: linear-gradient(160deg, #ece7de, #dfece9);
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.product-card:hover .product-media img { transform: scale(1.04); }

.chip {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

.chip.tiny { position: static; display: inline-block; margin-left: 0.35rem; }

.product-body {
  padding: 1rem 1rem 1.15rem;
  display: grid;
  gap: 0.45rem;
  flex: 1;
}

.product-cat { margin: 0; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
.product-body h3 { font-size: 1.05rem; }
.product-body h3 a { color: inherit; text-decoration: none; }
.product-meta { display: flex; align-items: baseline; gap: 0.5rem; }
.price { font-weight: 750; font-size: 1.05rem; }
.compare { color: var(--muted); text-decoration: line-through; font-size: 0.9rem; }

.shop-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.filters, .panel, .auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(18, 21, 28, 0.03);
}

.filter-form, .stack-form { display: grid; gap: 0.9rem; }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 550;
}

.check input { width: auto; }

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.product-gallery {
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(160deg, #ece7de, #dfece9);
  border: 1px solid var(--line);
}

.product-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.product-info .breadcrumb {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.product-info h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); margin-bottom: 0.75rem; }
.product-meta.large .price { font-size: 1.5rem; }
.stock.in { color: var(--success); font-weight: 650; }
.stock.out { color: var(--danger); font-weight: 650; }
.buy-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: end;
  margin-top: 1.25rem;
}
.buy-form label { min-width: 110px; }
.buy-form input { width: 110px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.cart-product {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cart-product img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
}

.cart-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.cart-summary {
  display: grid;
  gap: 0.75rem;
  justify-items: end;
}

.checkout-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.25rem;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

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

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.summary-list li,
.summary-totals p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.summary-totals .total {
  font-size: 1.1rem;
  font-weight: 750;
  border-bottom: 0;
}

.alert {
  margin: 1rem auto;
  width: min(1120px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid;
}

.admin-content .alert,
.panel .alert,
.auth-card .alert { width: auto; margin: 0 0 1rem; }

.alert-success, .alert-success { background: #ecfdf3; border-color: #abefc6; color: var(--success); }
.alert-error, .alert-danger { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: var(--info); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-success { background: #ecfdf3; color: var(--success); }
.badge-warning { background: #fffaeb; color: var(--warning); }
.badge-info { background: #eff8ff; color: var(--info); }
.badge-primary { background: var(--accent-soft); color: var(--accent-dark); }
.badge-danger { background: #fef3f2; color: var(--danger); }
.badge-muted { background: #f5f5f4; color: var(--muted); }

.empty-state, .auth-card {
  text-align: left;
}

.empty-state {
  padding: 2.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.6);
}

.pagination {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.pagination a {
  min-width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.pagination a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-footer {
  margin-top: 2rem;
  padding: 2.5rem 0 1.5rem;
  background: #171a22;
  color: #d7dbe5;
}

.site-footer a { color: #d7dbe5; display: block; margin: 0.35rem 0; }
.site-footer h4 { color: #fff; margin-bottom: 0.75rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.brand-footer { color: #fff; margin-bottom: 0.75rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1rem;
  color: #9aa3b5;
  font-size: 0.9rem;
}

.owner-only-link {
  margin-left: 0.75rem;
  color: #6b7280;
  font-size: 0.8rem;
  text-decoration: none;
  opacity: 0.55;
}

.owner-only-link:hover {
  opacity: 1;
  color: #a7f3d0;
  text-decoration: none;
}

.brand-mark {
  cursor: default;
}

.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* Admin */
.admin-body {
  background: #ece8e1;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: #12151c;
  color: #fff;
  padding: 1.25rem;
}

.admin-sidebar .brand { color: #fff; margin-bottom: 1.5rem; }
.admin-sidebar nav { display: grid; gap: 0.35rem; }
.admin-sidebar a {
  color: #c9ced8;
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-weight: 550;
}
.admin-sidebar a:hover { background: rgba(255,255,255,0.06); color: #fff; }

.admin-main { padding: 1rem 1.25rem 2rem; }
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.admin-top h1 { margin: 0; font-size: 1.5rem; }
.admin-content { display: grid; gap: 1rem; }

.stats-grid { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.35rem;
}
.stat-card span { color: var(--muted); font-size: 0.9rem; }
.stat-card strong { font-family: var(--display); font-size: 1.7rem; }
.stat-card.warn { border-color: #f9dbaf; background: #fffaf0; }

.admin-two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.image-preview img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.setup-card { width: min(520px, 100%); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateX(24px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes morph {
  0%, 100% { border-radius: 40% 60% 55% 45%; transform: rotate(0deg); }
  50% { border-radius: 55% 45% 40% 60%; transform: rotate(4deg); }
}

@media (max-width: 980px) {
  .hero-grid,
  .product-detail,
  .shop-layout,
  .checkout-layout,
  .admin-two-col,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .category-grid,
  .product-grid,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 84vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 50;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 1rem;
    right: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
}

@media (max-width: 640px) {
  .category-grid,
  .product-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .cart-table thead { display: none; }
  .cart-table tr {
    display: grid;
    gap: 0.4rem;
    padding: 0.85rem 0;
  }
  .data-table { font-size: 0.92rem; }
}
