:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #e6f2f0;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f8;
  --card: #ffffff;
  --ok: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  --accent: #f59e0b;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: 400; margin-left: .4em; }
h2 { font-size: 1.25rem; margin: 0; }
h3 { margin: 0 0 .8em; font-size: 1.05rem; }
h4 { margin: 1.2em 0 .5em; font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
input, select, textarea {
  font: inherit; padding: .55em .7em; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
code { background: #f1f5f9; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; padding: .65em 1.2em;
  border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; margin-top: .8em; }
.btn-danger { background: var(--bad); color: #fff; }
.danger-link { color: var(--bad); }
.prose { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.prose h2 { font-size: 1.15rem; margin-top: 1.6em; }
.prose li { margin-bottom: .4em; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Header */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: .5em; font-weight: 700; font-size: 1.15rem; color: var(--ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { background: var(--primary); color: #fff; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.search { flex: 1; position: relative; display: flex; }
.search input { border-radius: 8px 0 0 8px; background: var(--bg); }
.search button { border: 0; background: var(--primary); color: #fff; padding: 0 1em; border-radius: 0 8px 8px 0; font-size: 1.2rem; cursor: pointer; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-radius: 0 0 8px 8px; box-shadow: 0 8px 20px #0002; }
.suggest a { display: block; padding: .55em .9em; color: var(--ink); border-top: 1px solid var(--line); }
.suggest a small { color: var(--muted); }
.top-actions { display: flex; gap: 18px; align-items: center; white-space: nowrap; }
.top-actions a { color: var(--ink); font-weight: 500; }
.cart-link { position: relative; }
.badge { background: var(--accent); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .45em; margin-left: .3em; font-weight: 700; }
.catbar { border-top: 1px solid var(--line); }
.catbar-inner { display: flex; gap: 6px; }
.catbar-item { position: relative; }
.catbar-item > a { display: block; padding: .6em .9em; color: var(--ink); font-weight: 500; }
.dropdown { display: none; position: absolute; top: 100%; left: 0; background: #fff; min-width: 220px; box-shadow: 0 10px 25px #0002; border-radius: 0 0 8px 8px; padding: .4em 0; }
.dropdown a { display: block; padding: .45em 1em; color: var(--ink); }
.dropdown a:hover { background: var(--primary-soft); text-decoration: none; }
.catbar-item:hover .dropdown { display: block; }

main { padding-top: 16px; padding-bottom: 48px; min-height: 60vh; }
.flash { padding: .8em 1em; border-radius: 8px; margin: 0 0 1em; background: #eff6ff; border: 1px solid #bfdbfe; }
.flash-success { background: #f0fdf4; border-color: #bbf7d0; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: var(--bad); }

/* Home */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; padding: 36px;
  background: linear-gradient(120deg, #0f766e, #134e4a); color: #fff; border-radius: 16px; margin-bottom: 24px;
}
.hero h1 { font-size: 2.1rem; line-height: 1.2; }
.hero p { opacity: .9; font-size: 1.05rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1em; }
.hero .btn-primary { background: #fff; color: var(--primary); }
.hero .btn-ghost { background: transparent; border-color: #fff8; color: #fff; }
.usp { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.usp li { background: #ffffff14; border-radius: 10px; padding: .7em 1em; display: flex; flex-direction: column; }
.usp span { opacity: .8; font-size: .9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 28px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9em; color: var(--ink); font-weight: 500; display: flex; align-items: center; gap: .5em; }
.tile:hover { border-color: var(--primary); text-decoration: none; }
.tile span { font-size: 1.3rem; }
section { margin-bottom: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.brands { display: flex; flex-wrap: wrap; gap: 10px; }
.brands a { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: .45em 1.1em; color: var(--ink); font-weight: 500; }
.calc-banner { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 16px; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }

/* Product cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 8px 24px #0001; text-decoration: none; }
.card-body { padding: .8em .9em 1em; }
.brand { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.card-title { font-weight: 500; margin: .15em 0 .4em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3em; }
.card-meta { display: flex; justify-content: space-between; font-size: .8rem; margin-top: .3em; }
.price { font-weight: 700; font-size: 1.1rem; }
.mrp { text-decoration: line-through; color: var(--muted); margin-left: .5em; font-size: .9rem; }
.off { color: var(--ok); margin-left: .5em; font-weight: 600; font-size: .9rem; }
.stars { background: var(--ok); color: #fff; padding: 0 .45em; border-radius: 4px; font-size: .8rem; font-weight: 600; }
.oos { color: var(--bad); font-weight: 600; }
.thumb { aspect-ratio: 1; display: grid; place-items: center; background: linear-gradient(160deg, #f8fafc, color-mix(in srgb, var(--tint) 35%, #fff)); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .can { width: 62%; }
.thumb-icon { font-size: 4rem; }
.thumb-big { border-radius: 16px; border: 1px solid var(--line); }
.thumb-big .thumb-icon { font-size: 8rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0003; vertical-align: -2px; margin-right: .35em; }

/* Listing */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .6em; }
.listing { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.filters { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1em; align-self: start; position: sticky; top: 120px; }
.filters h4:first-of-type { margin-top: 0; }
.filter-link { display: block; padding: .2em 0; }
.filter-clear { display: block; text-align: center; margin-top: .6em; font-size: .9rem; }
.price-range { display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: .5em; padding: .15em 0; cursor: pointer; }
.check input { width: auto; }
.listing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.listing-head h1 { margin: 0; }
.listing-head select { width: auto; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pager a { padding: .4em .8em; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager a.active { background: var(--primary); color: #fff; }
.empty { background: #fff; border: 1px dashed #cbd5e1; border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* Product page */
.pdp { display: grid; grid-template-columns: 1fr 1.1fr; gap: 36px; background: #fff; padding: 24px; border-radius: 16px; border: 1px solid var(--line); }
.pdp-media { position: sticky; top: 120px; align-self: start; }
.pdp-info h1 { margin: .1em 0 .3em; }
.pdp-price { margin-top: .8em; }
.pdp-price .price { font-size: 1.7rem; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.variant { border: 1.5px solid var(--line); border-radius: 8px; padding: .55em .7em; cursor: pointer; display: flex; gap: .5em; align-items: flex-start; }
.variant input { width: auto; margin-top: .3em; }
.variant small { display: block; color: var(--muted); }
.variant:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.variant.disabled { opacity: .5; cursor: not-allowed; }
.qty-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 1.2em; flex-wrap: wrap; }
.qty-row label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.qty-row input { width: 80px; }
.calc { margin-top: 1.4em; background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius); padding: 1em; }
.calc h4 { margin-top: 0; color: var(--warn); }
.calc-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-row label { font-size: .8rem; color: var(--muted); }
.calc-result { margin: .8em 0 .2em; }
.pdp-usp { list-style: none; padding: 0; margin: 1.4em 0 0; display: grid; gap: .4em; font-size: .92rem; }
.pdp-details { display: grid; gap: 20px; margin: 24px 0; }
.pdp-details section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0; }
.pdp-details h2 { margin-bottom: .6em; }
.specs { border-collapse: collapse; width: 100%; max-width: 640px; }
.specs th, .specs td { text-align: left; padding: .5em .8em; border-bottom: 1px solid var(--line); }
.specs th { width: 40%; color: var(--muted); font-weight: 500; }
.review { border-bottom: 1px solid var(--line); padding: .6em 0; }
.review b { color: var(--accent); }
.review p { margin: .2em 0 0; }
.review-form { display: grid; gap: 8px; max-width: 500px; margin-top: 1em; }
.review-form select { width: auto; }

/* Panels, cart, checkout */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel.narrow { max-width: 440px; margin: 20px auto; }
section.panel.narrow:has(.address-form) { max-width: 760px; }
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.summary { position: sticky; top: 120px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: .3em 0; }
.row.total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--line); margin-top: .4em; padding-top: .7em; }
.row.save { color: var(--ok); }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto 90px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border: 0; }
.cart-thumb .thumb { border-radius: 8px; }
.cart-thumb .thumb-icon { font-size: 2.2rem; }
.cart-total { text-align: right; font-weight: 600; }
.qty-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qty-form button:not(.link-btn) { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1rem; }
.qty-form span { min-width: 22px; text-align: center; font-weight: 600; }
.qty-form .link-btn { font-size: .85rem; margin-left: 8px; }
.choices { display: grid; gap: 8px; }
.choice, .slot { display: flex; gap: .7em; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 8px; padding: .7em .9em; cursor: pointer; }
.choice input, .slot input { width: auto; margin-top: .3em; }
.choice:has(input:checked), .slot:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.slot { font-size: .9rem; }
.coupon { display: flex; gap: 8px; margin: .6em 0; }
.coupon .btn { padding: .5em .9em; }
.delivery-msg { font-weight: 500; margin: .6em 0; }
.add-address summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.add-address[open] summary { margin-bottom: 1em; }

/* Address form + maps */
.address-form { display: grid; gap: 10px; }
.map-search { display: flex; gap: 8px; }
.map-search .btn { white-space: nowrap; }
.map { height: 300px; border-radius: 8px; border: 1px solid var(--line); z-index: 0; margin-top: .6em; }
.map-tall { height: 460px; margin: 0; }
.store-pin { font-size: 24px; line-height: 30px; text-align: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: end; }
.form-grid label, .stack label { font-size: .85rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid label.check { flex-direction: row; color: var(--ink); }
.stack { display: grid; gap: 12px; }

/* Account */
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.order-row { display: grid; grid-template-columns: 1fr auto 100px; gap: 12px; align-items: center; padding: .8em 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.order-row:hover { background: var(--bg); text-decoration: none; }
.order-row > div:last-child { text-align: right; }
.addr { border-bottom: 1px solid var(--line); padding: .6em 0; }
.pill { display: inline-block; padding: .1em .6em; border-radius: 99px; font-size: .75rem; font-weight: 600; background: #f1f5f9; color: var(--muted); vertical-align: middle; }
.pill-delivered, .pill-paid { background: #dcfce7; color: var(--ok); }
.pill-cancelled, .pill-failed { background: #fee2e2; color: var(--bad); }
.pill-confirmed, .pill-packed, .pill-out_for_delivery { background: #e0f2fe; color: #0369a1; }
.pill-pending, .pill-cod, .pill-placed { background: #fef3c7; color: var(--warn); }
.pill-refunded { background: #ede9fe; color: #6d28d9; }
.tracker { display: flex; list-style: none; padding: 0; margin: 0 0 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tracker li { flex: 1; text-align: center; padding: .8em .4em; font-size: .85rem; color: var(--muted); border-right: 1px solid var(--line); }
.tracker li:last-child { border: 0; }
.tracker li.done { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Admin */
.admin-nav { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-nav a { padding: .6em 1em; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.admin-nav a.active { color: var(--primary); border-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1em; display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat b { font-size: 1.5rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .55em .6em; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table-scroll { overflow-x: auto; }
.variants-table input { padding: .35em .5em; min-width: 70px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 1em; }
.inline-form input, .inline-form select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips a { padding: .3em .9em; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; }
.chips a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Footer */
.footer { background: #111827; color: #d1d5db; padding: 36px 0; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer a { color: #d1d5db; }
.footer p { margin: .3em 0; font-size: .9rem; }
.footer strong { color: #fff; }

/* Invoice (print) */
body.invoice { background: #fff; max-width: 900px; margin: 0 auto; padding: 32px; }
.invoice-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--ink); margin-bottom: 1em; }
.invoice-head .right { text-align: right; }
.inv-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 1em 0; }
.inv-table th, .inv-table td { border: 1px solid #cbd5e1; padding: .45em .5em; text-align: right; }
.inv-table th:nth-child(2), .inv-table td:nth-child(2), .inv-table th:nth-child(3), .inv-table td:nth-child(3) { text-align: left; }
.inv-table tfoot td:first-child { text-align: right; }
.inv-table .grand td { font-weight: 700; font-size: 1rem; }
.invoice-actions { text-align: right; }
@media print { .invoice-actions { display: none; } body.invoice { padding: 0; } }

/* Mobile */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero h1 { font-size: 1.6rem; }
  .listing, .pdp, .two-col { grid-template-columns: 1fr; }
  .filters, .pdp-media, .summary { position: static; }
  .pdp { padding: 16px; gap: 20px; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .logo span:last-child { font-size: 1rem; }
  .top-actions { margin-left: auto; gap: 12px; font-size: .9rem; }
  .hide-sm { display: none; }
  .catbar-inner { overflow-x: auto; }
  .dropdown { display: none !important; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cart-line { grid-template-columns: 64px 1fr; }
  .cart-line .qty-form, .cart-line .cart-total { grid-column: 2; text-align: left; }
  .calc-row { grid-template-columns: 1fr 1fr; }
  .variants { grid-template-columns: 1fr 1fr; gap: 6px; }
  .variant { padding: .45em .5em; font-size: .88rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .map-search { flex-direction: column; }
  .calc-banner { flex-direction: column; align-items: flex-start; }
  .tracker { flex-direction: column; }
  .tracker li { border-right: 0; border-bottom: 1px solid var(--line); }
  .table { font-size: .85rem; }
}
