:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1e2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --ok: #12805c;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px;
  flex: 0 0 226px;
  background: #111827;
  color: #d1d5db;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand { font-weight: 700; font-size: 17px; color: #fff; line-height: 1.4; }
.brand span { display: block; font-size: 11px; color: #9ca3af; font-weight: 400; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  color: #d1d5db; padding: 7px 10px; border-radius: 8px; font-size: 13.5px;
}
.sidebar nav a:hover { background: #1f2937; text-decoration: none; }
.sidebar nav a.active { background: #2563eb; color: #fff; }

.who { margin-top: auto; border-top: 1px solid #1f2937; padding-top: 12px; font-size: 12.5px; }
.who .link { color: #93c5fd; background: none; border: 0; padding: 0; cursor: pointer; font-size: 12.5px; }

main { flex: 1; padding: 22px 26px 60px; min-width: 0; }

.topbar { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.topbar h1 { font-size: 20px; margin: 0; font-weight: 650; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.flash { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.flash.ok { background: #e7f6ef; color: var(--ok); border: 1px solid #bfe6d6; }
.flash.err { background: #fdecec; color: var(--err); border: 1px solid #f5c6c6; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px;
}
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.card .sub { font-size: 11.5px; color: var(--muted); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px;
}
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th, table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
table th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; }
table tr:last-child td { border-bottom: 0; }
table tr:hover td { background: #fafcff; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; border: 1px solid var(--border); }
.tag.ok { color: var(--ok); border-color: #bfe6d6; background: #eefaf4; }
.tag.warn { color: var(--warn); border-color: #f2ddb8; background: #fdf6e9; }
.tag.err { color: var(--err); border-color: #f5c6c6; background: #fdeeee; }
.tag.info { color: var(--accent); border-color: #c7d8fb; background: #eff4ff; }

form.inline { display: inline; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

button, .btn {
  display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-family: inherit; font-size: 13px; cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.05); text-decoration: none; }
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
button.danger { background: var(--err); border-color: var(--err); }
button:disabled { opacity: .55; cursor: not-allowed; }

.filters { display: flex; gap: 8px; align-items: end; margin-bottom: 12px; flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 150px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 12.5px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 26px; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card .brand { color: #111827; font-size: 15px; margin-bottom: 18px; }

pre, code { font-family: "JetBrains Mono", Consolas, monospace; direction: ltr; unicode-bidi: embed; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.stack { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* FAQ accordion: the question is the row, the answer opens underneath and stays hidden
   until asked for. Native <details> keeps it working with the script-src 'self' policy. */
.faq-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; }
details.faq {
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  background: #fbfcfd;
  padding: 0 12px;
}
details.faq > summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::before {
  content: '▸';
  color: #6b7a90;
  font-weight: 400;
}
details.faq[open] > summary::before { content: '▾'; }
details.faq[open] > summary { border-bottom: 1px solid #eef2f7; margin-bottom: 8px; }
.faq-body { padding-bottom: 10px; }
.faq-a { margin: 6px 0 10px; line-height: 1.9; }
details.faq-edit { margin-bottom: 8px; }
details.faq-edit > summary { cursor: pointer; }

/* Contact tagging: the picker must stay usable inside a table cell, where a
   native multi-select would otherwise be squeezed to one row. */
.tagcell { min-width: 150px; }
.tagpick { display: flex; flex-direction: column; gap: 6px; }
.tagpick select { min-height: 62px; }
.tagform { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.tagform select { min-height: 58px; }
details.tagedit { margin-top: 4px; }
details.tagedit > summary {
  cursor: pointer; font-size: 11.5px; color: var(--accent);
  list-style: none; user-select: none;
}
details.tagedit > summary::-webkit-details-marker { display: none; }
details.tagedit > summary::before { content: '＋ '; }
details.tagedit[open] > summary::before { content: '▾ '; }

/* ---- sales surface (/sales) ----------------------------------------------
   The representative's page wears no sidebar: a search box on top and the whole
   catalogue below it, wide enough to read a row without scrolling sideways. */
.sales-shell { min-height: 100vh; background: #f4f6f9; }
.sales-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px; background: #1f2a3a; color: #fff;
}
.sales-topbar .brand { color: #fff; }
.sales-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.sales-user form { margin: 0; }
.sales-user button.link { color: #cbd5e1; }
.sales-main { padding: 18px 20px 40px; max-width: 1280px; margin: 0 auto; }
.sales-search {
  background: #fff; border: 1px solid #e3e9f0; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px;
}
.sales-search-row { display: flex; gap: 10px; }
.sales-search-row input[type="search"] {
  flex: 1; padding: 11px 14px; font-size: 15px; border: 1px solid #cfd8e3;
  border-radius: 8px; font-family: inherit;
}
.sales-search-row button { padding: 0 26px; font-size: 14px; }
.sales-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 10px; }
.sales-filters select { padding: 6px 8px; }
.sales-count { margin: 0 2px 10px; font-size: 13px; color: #475569; }
.sales-table { background: #fff; border: 1px solid #e3e9f0; border-radius: 10px; }
.sales-table th, .sales-table td { vertical-align: top; }
.sales-table td { border-top: 1px solid #eef2f7; }
.sales-name { font-weight: 600; margin-bottom: 4px; }
.sales-attrs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.sales-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.sales-hint { margin-top: 14px; }

/* ---- /sales: the expanded product row (full information + edit form) ------ */
.sales-row-open { background: #f8fafc; }
.sales-toggle { margin-top: 6px; }
.sales-detail-row > td { background: #fbfcfe; padding: 0 !important; border-top: 1px solid #e3e9f0; }
.sales-detail { padding: 16px 18px 20px; }
.sales-detail-head h2 { margin: 0 0 4px; font-size: 16px; }
.sales-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 12px 0; }
.sales-detail h3 { margin: 12px 0 6px; font-size: 13px; color: #334155; }
.sales-plain { margin: 0; padding-inline-start: 18px; font-size: 13px; line-height: 1.9; }
.sales-desc { margin: 8px 0; font-size: 13px; line-height: 1.9; color: #334155; }
.sales-edit { border-top: 1px dashed #dbe3ec; margin-top: 10px; padding-top: 8px; max-width: 720px; }
.sales-price-table { background: #fff; border: 1px solid #e3e9f0; border-radius: 8px; margin-bottom: 10px; }
.sales-price-table td, .sales-price-table th { padding: 6px 10px; }
.sales-price-table input[type="number"] { max-width: 150px; }
@media (max-width: 900px) { .sales-detail-cols { grid-template-columns: 1fr; } }

/* ---- /sales: two rows per product (specs, then prices) ------------------- */
.sales-table-2row .sales-spec-row > td { border-top: 1px solid #eef2f7; padding-bottom: 2px; }
.sales-table-2row .sales-price-row > td { border-top: none; padding-top: 2px; padding-bottom: 12px; background: #fcfdfe; }
.sales-table-2row .sales-row-open > td { background: #f8fafc; }
.sales-price-label { color: #64748b; font-size: 12px; }
.sales-words { color: #475569; font-size: 12px; }
.sales-other-prices { margin-top: 5px; font-size: 12px; color: #334155; }

/* Help marker: a "?" next to a field label whose explanation appears on hover/focus. Pure
   CSS (attr(data-tip)) because the CSP forbids inline script, and it keeps long Persian
   explanations out of the form so the fields stay readable. */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-inline-start: 4px; border-radius: 50%;
  background: #eef4ff; color: var(--accent); border: 1px solid #c7d8fb;
  font-size: 11px; line-height: 1; cursor: help; position: relative; vertical-align: middle;
}
.help::before {
  content: ''; position: absolute; top: 135%; right: 4px;
  border: 6px solid transparent; border-bottom-color: #1f2937;
  opacity: 0; visibility: hidden; transition: opacity .12s; z-index: 60;
}
.help::after {
  content: attr(data-tip); position: absolute; top: 165%; right: -6px; z-index: 61;
  width: 270px; max-width: 70vw; padding: 9px 11px; border-radius: 8px;
  background: #1f2937; color: #fff; font-size: 11.5px; line-height: 1.8; font-weight: normal;
  text-align: right; white-space: normal; box-shadow: 0 8px 22px rgba(0,0,0,.22);
  opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none;
}
.help:hover::before, .help:hover::after,
.help:focus::before, .help:focus::after { opacity: 1; visibility: visible; }

/* ---- product gallery (panel) -------------------------------------------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { margin: 0; width: 120px; }
.thumb img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #e3e9f0; background: #f8fafc; }
.thumb form { margin-top: 4px; }
button.small { padding: 2px 8px; font-size: 12px; }

/* ظاهر فروشگاه: فرم سمت راست، خودِ فروشگاه در قاب گوشی سمت چپ */
.look-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}
.look-head h1{margin:0}
.btn-primary{background:#2d6a4f;color:#fff;border:0;border-radius:11px;padding:10px 20px;font:inherit;
  font-weight:700;cursor:pointer;box-shadow:0 6px 16px -10px rgba(45,106,79,.8)}
.btn-primary:active{transform:translateY(1px)}
.look{display:grid;grid-template-columns:minmax(320px,1fr) 400px;gap:20px;align-items:start}
.look-form{display:grid;gap:14px}
.look-block{background:#fff;border:1px solid #e6ebef;border-radius:16px;padding:16px 16px 18px;
  box-shadow:0 1px 3px rgba(16,36,51,.04)}
.look-block h2{font-size:14px;margin:0 0 4px;color:#0f2431}
.look-block .muted{margin:0 0 10px}
.look-input{width:100%;height:42px;border:1px solid #dde5ea;border-radius:10px;padding:0 12px;font:inherit;background:#fbfdfe}
.look-input:focus{outline:2px solid rgba(45,106,79,.22);border-color:#2d6a4f;background:#fff}
.look-presets{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.preset{display:flex;align-items:center;gap:8px;border:1px solid #e6ebef;background:#fbfdfe;border-radius:11px;
  padding:9px 11px;font:inherit;font-size:12.5px;color:#23414f;cursor:pointer;text-align:start}
.preset:hover{border-color:#c9d7de;background:#fff}
.preset .sw{display:inline-flex;gap:3px;flex:0 0 auto}
.preset .sw i{width:12px;height:12px;border-radius:50%;display:block;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08)}
.look-colors{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.swatch{display:flex;align-items:center;gap:10px;border:1px solid #e6ebef;border-radius:12px;padding:8px 10px;background:#fbfdfe;cursor:pointer}
.swatch input[type=color]{width:32px;height:32px;border:0;padding:0;background:transparent;border-radius:50%;flex:0 0 auto;cursor:pointer}
.swatch input[type=color]::-webkit-color-swatch-wrapper{padding:0}
.swatch input[type=color]::-webkit-color-swatch{border:1px solid rgba(0,0,0,.12);border-radius:50%}
.swatch span{font-size:12.5px;color:#3c5563;flex:1}
.swatch b{font-size:11px;color:#7d8f9a;font-weight:600;letter-spacing:.02em;direction:ltr}
.look-radius{display:flex;align-items:center;gap:10px;margin-top:12px}
.look-radius label{font-size:12.5px;color:#3c5563}
.look-radius input{width:90px;height:36px;border:1px solid #dde5ea;border-radius:10px;padding:0 10px;font:inherit;direction:ltr;text-align:center}
.look-preview{position:sticky;top:14px;text-align:center}
.phone{width:390px;height:760px;max-height:76vh;margin:0 auto;border-radius:44px;background:#0e1b24;padding:12px;
  box-shadow:0 30px 70px -34px rgba(12,36,51,.6),0 3px 10px rgba(12,36,51,.16)}
.phone-screen{width:100%;height:100%;border-radius:34px;overflow:hidden;background:#fff}
.phone iframe{width:100%;height:100%;border:0;display:block}
@media (max-width:1100px){.look{grid-template-columns:1fr}.look-preview{position:static}.phone{width:100%;max-width:390px;height:640px}}
