/* Mobile-first: base styles are for phones; wider screens are in the media queries at the end. */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #616e7c;
  --primary: #1f6feb;
  --error: #c62828;
  --ok: #2e7d32;
  --border: #d9dee4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
img { max-width: 100%; }
a { color: var(--primary); }

/* Header */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1rem;
  padding: .6rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: bold; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.who { display: none; color: var(--muted); }
.topbar form.inline { margin-inline-start: auto; }
.nav { order: 3; width: 100%; display: flex; gap: 1.25rem; }
.nav a { color: var(--text); text-decoration: none; padding: .25rem 0; }

/* Layout */
.container { max-width: 960px; margin: 1rem auto; padding: 0 .75rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.card + .card { margin-top: 1rem; }
.narrow, .narrow-wide { margin: 1rem auto; }
h1 { font-size: 1.2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* Forms: large touch targets */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .25rem; }
.field input, select, textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: .65rem; border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.field input[type=checkbox] { width: 1.2rem; height: 1.2rem; vertical-align: middle; }
.field input[type=file] { padding: .4rem; }
.field textarea { min-height: 6rem; }
.has-error input, .has-error select { border-color: var(--error); }
.error, .errorlist { color: var(--error); font-size: .9rem; margin-top: .25rem; }
.errorlist { list-style: none; padding: 0; }
button, a.button {
  display: inline-block; font: inherit; padding: .65rem 1.2rem; border: 0; border-radius: 6px;
  background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; min-height: 44px;
}
button.link { background: none; color: var(--primary); padding: .25rem; min-height: 0; }
button.danger { color: var(--error); }
form.inline { display: inline; }
.form-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.message { padding: .6rem 1rem; border-radius: 6px; background: #e8f0fe; margin-bottom: 1rem; }
.message.error { background: #fdecea; color: var(--error); }
.message.success { background: #e3f4e8; color: #1b6b35; }

/* Filters */
.filters { margin: .5rem 0 1rem; display: flex; gap: .5rem; align-items: center; }
.filters select { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; }
.table th, .table td { padding: .55rem .4rem; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table th { font-weight: normal; color: var(--muted); font-size: .85rem; }
.table tr.inactive { opacity: .55; }
.table .col-img { width: 56px; }
.table .col-status { width: 1.5rem; text-align: center; }
.table .col-num { white-space: nowrap; }
.table .col-actions { white-space: nowrap; text-align: left; }
.table a { text-decoration: none; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; display: block; background: #eef1f4; }
.subtitle { display: block; color: var(--muted); font-size: .85rem; }

/* Status dot */
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; }
.dot.ok { background: var(--ok); }
.dot.off { background: var(--error); }

.badge { display: inline-block; padding: 0 .5rem; border-radius: 4px; font-size: .85rem; background: #eef1f4; }
.badge.ok { background: #e3f4e8; color: #1b6b35; }

/* Product details */
.details { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* Gallery: two per row on phones */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.gallery figcaption { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }

/* Category tree */
.indent-1 { padding-inline-start: 1.25rem !important; }
.indent-2 { padding-inline-start: 2.5rem !important; }
.indent-3 { padding-inline-start: 3.75rem !important; }
.move-btn { background: none; color: var(--text); border: 1px solid var(--border); padding: .2rem .6rem; min-height: 36px; }
.move-btn:disabled { opacity: .3; cursor: default; }

/* Wider screens */
@media (min-width: 640px) {
  .container { padding: 0 1rem; margin: 1.5rem auto; }
  .card { padding: 1.25rem; }
  .narrow { max-width: 420px; margin: 2rem auto; }
  .narrow-wide { max-width: 640px; }
  .who { display: inline; margin-inline-start: auto; }
  .topbar form.inline { margin-inline-start: 0; }
  .nav { order: 0; width: auto; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  h1 { font-size: 1.3rem; }
}

/* Shop panel */
.count { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: .8rem; text-align: center; line-height: 1.4rem; }
.message.warning { background: #fff4e0; color: #8a5300; }
.search { display: flex; gap: .5rem; margin-bottom: .5rem; }
.search input { flex: 1; font: inherit; padding: .6rem; border: 1px solid var(--border); border-radius: 6px; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .5rem; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.chips a { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.chips a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips-sub a { font-size: .85rem; padding: .2rem .7rem; }

/* Home: welcome and one tile per store */
.welcome { margin-bottom: .75rem; }
.lead { margin: 1rem 0 .75rem; font-weight: bold; }
.store-tiles { display: grid; grid-template-columns: 1fr; gap: .6rem; }
.store-tile { display: grid; grid-template-columns: 88px 1fr; grid-template-rows: auto auto 1fr; column-gap: .75rem; align-items: start; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .6rem; color: var(--text); text-decoration: none; }
.store-tile .tile-img { grid-row: 1 / 4; width: 88px; height: 88px; object-fit: cover; border-radius: 8px; background: #eef1f4; display: block; }
.store-tile .tile-name { font-weight: bold; }
.store-tile .tile-count { font-size: .85rem; color: var(--primary); }

/* Store page */
.store-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.store-head h1 { margin: 0; }
.store-head .back { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; font-size: 1.2rem; flex: none; }
.cat-logo, .cat-dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; object-fit: cover; flex: none; display: inline-block; }
.cat-dot { width: .8rem; height: .8rem; margin: .3rem; }
.chips .cat-logo { width: 1.3rem; height: 1.3rem; }
.chips a.active .cat-dot { box-shadow: 0 0 0 2px #fff; }
.cat-list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.cat-list li + li { border-top: 1px solid var(--border); }
.cat-list a { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; color: var(--text); text-decoration: none; }
.cat-list .cat-name { flex: 1; }
.cat-list .cat-count { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.cat-list .depth-1 a { padding-inline-start: 2rem; font-size: .95rem; }
.cat-list .depth-2 a { padding-inline-start: 3.25rem; font-size: .9rem; }
.cat-list .depth-3 a, .cat-list .depth-4 a { padding-inline-start: 4.5rem; font-size: .9rem; }
.cat-head, .group-head { display: flex; align-items: center; gap: .5rem; margin: .75rem 0 .5rem; }
.cat-head .cat-logo { width: 2rem; height: 2rem; }
.group-head { grid-column: 1 / -1; font-size: .95rem; color: var(--muted); margin: .5rem 0 0; }

/* Product card: picture beside name, subtitle, unit price */
.products { display: grid; grid-template-columns: 1fr; gap: .6rem; }
.product-card { display: grid; grid-template-columns: 76px 1fr; gap: .75rem; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: .5rem; color: var(--text); text-decoration: none; }
.product-card.open { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.product-card .pimg { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; background: #eef1f4; display: block; }
.product-card .pinfo { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.product-card .pname { font-weight: bold; }
.product-card .pprice { font-size: .95rem; }
.under-review { color: var(--muted); font-weight: bold; }
.pack-badge { display: inline-block; font-size: .7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 .4rem; line-height: 1.5; vertical-align: middle; }
.cart-badge { display: inline-block; margin-top: .2rem; font-size: .8rem; font-weight: bold; color: #fff; background: var(--ok); border-radius: 999px; padding: 0 .55rem; line-height: 1.6; }
.cart-badge[hidden] { display: none; }

/* Product panel, opened under the card's row */
.show-product-panel { grid-column: 1 / -1; background: var(--card); border: 1px solid var(--primary); border-radius: 8px; padding: .75rem; }
.panel-inner { position: relative; }
.panel-close { position: absolute; top: 0; left: 0; z-index: 1; background: rgba(255,255,255,.9); color: var(--text); border: 1px solid var(--border); border-radius: 50%; width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 1.3rem; line-height: 1; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-radius: 6px; background: #eef1f4; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: 0 0 100%; width: 100%; aspect-ratio: 1; object-fit: contain; scroll-snap-align: center; }
.slide-dots { display: flex; justify-content: center; gap: .35rem; margin-top: .4rem; }
.slide-dots span { width: .5rem; height: .5rem; border-radius: 50%; background: var(--border); }
.slide-dots span.on { background: var(--primary); }
.panel-title { margin: .6rem 0 0; font-size: 1.1rem; }
.show-product-panel .subtitle { margin: 0; }
.crumbs { color: var(--muted); font-size: .85rem; margin: .3rem 0 .6rem; }
.spec { width: 100%; border-collapse: collapse; margin-bottom: .5rem; }
.spec th, .spec td { text-align: right; padding: .45rem .3rem; border-bottom: 1px solid var(--border); }
.spec th { font-weight: normal; color: var(--muted); width: 45%; }
.panel-msg:empty { display: none; }
.panel-msg { margin-top: .5rem; padding: .5rem .75rem; border-radius: 6px; font-size: .9rem; }
.panel-msg.ok { background: #e3f4e8; color: #1b6b35; }
.panel-msg.error { background: #fdecea; color: var(--error); }
.price { font-weight: bold; }
.add-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .4rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.stepper button { background: #f0f2f5; color: var(--text); min-height: 40px; min-width: 40px; padding: 0 .6rem; border-radius: 0; font-size: 1.2rem; line-height: 1; }
.stepper input { width: 4.2rem; border: 0; text-align: center; font: inherit; padding: .4rem 0; }
.cart-group + .cart-group { margin-top: 1.25rem; }
.cart-line { border-bottom: 1px solid var(--border); padding: .75rem 0; }
.cart-line:last-of-type { border-bottom: 0; }
.cart-line.unavailable { opacity: .7; }
.cart-line .line-head { display: flex; justify-content: space-between; gap: .5rem; }
.cart-line .note-input { width: 100%; margin-top: .4rem; font: inherit; padding: .45rem; border: 1px solid var(--border); border-radius: 6px; }
.line-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .4rem; }
.total-row { display: flex; justify-content: space-between; font-weight: bold; padding: .75rem 0; border-top: 2px solid var(--border); }
.pager { display: flex; justify-content: center; gap: 1rem; margin: 1rem 0; }
.status-badge { font-size: .85rem; padding: 0 .5rem; border-radius: 4px; background: #eef1f4; }
@media (min-width: 640px) {
  .products { grid-template-columns: repeat(2, 1fr); }
  .show-product-panel .panel-inner { max-width: 560px; margin: 0 auto; }
}
@media (min-width: 900px) {
  .products { grid-template-columns: repeat(3, 1fr); }
}
.status-badge.ok { background: #e3f4e8; color: #1b6b35; }
.status-badge.off { background: #fdecea; color: var(--error); }

/* Public pages (landing, sign-up): brand colours from the logo. Phone first. */
.brand img { display: block; height: 36px; width: auto; }
.public-nav { margin-inline-start: auto; display: flex; gap: .5rem; }
.public-nav .button, .narrow .center .button { background: var(--brand); }
.public-nav .button { padding: .4rem .9rem; min-height: 40px; }
.public-nav .button.outline { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.center { text-align: center; }
:root { --brand: #00737a; --brand-accent: #e8600c; }
.accent { color: var(--brand-accent); }
.landing-hero { display: flex; flex-direction: column; gap: 1rem; padding: .5rem 0 1rem; }
.landing-hero h1 { font-size: 1.35rem; line-height: 1.8; margin: 0 0 .5rem; }
.landing-hero p { color: var(--muted); margin: 0 0 1rem; }
/* Both "ورود و دیدن محصولات" buttons on the landing page look the same. */
.button.cta { display: block; text-align: center; background: var(--brand); }
.hero-img { width: 100%; height: auto; }
.landing-section { background: var(--card); border-radius: 12px; padding: 1.25rem 1rem; margin-bottom: 1rem; }
.landing-section h2 { font-size: 1.1rem; margin: 0 0 .25rem; color: var(--brand); }
.perks { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: 1rem; }
.perks li { display: flex; gap: .85rem; align-items: center; }
.perks svg {
  flex: none; width: 48px; height: 48px; padding: 10px; border-radius: 50%; background: #e6f6f6;
  fill: none; stroke: var(--brand); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.perks h3 { font-size: 1rem; margin: 0; color: var(--brand-accent); }
.perks p { margin: 0; color: var(--muted); font-size: .9rem; }
.contact { margin: 1rem 0; }
.contact dt { color: var(--muted); font-size: .85rem; margin-top: .75rem; }
.contact dd { margin: 0; }
.contact a { color: var(--brand); text-decoration: none; }
.ltr-start { text-align: right; }
.shelf-img { width: 100%; height: auto; margin-top: .5rem; }
@media (min-width: 720px) {
  .landing-hero { flex-direction: row; align-items: center; }
  .hero-text { flex: 5; }
  .hero-img { flex: 7; min-width: 0; }
  .button.cta { display: inline-block; }
  .perks { grid-template-columns: repeat(3, 1fr); }
  .perks li { flex-direction: column; text-align: center; }
  .landing-section { padding: 2rem; }
  .shelf-img { display: block; max-width: 480px; margin: 1rem auto 0; }
}
