@font-face{font-family:Abar;src:url('/static/fonts/AbarMidFaNum-Regular.woff2') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:Abar;src:url('/static/fonts/AbarMidFaNum-Bold.woff2') format('woff2');font-weight:700;font-display:swap}
/* اسپهبد خورشید — صفحه‌ی قیمت‌گذاری
   تنها عنصر پررنگ: «تابلوی نرخ» (لاجوردی با ارقام طلایی، مثل تابلوی نرخ طلافروشی).
   بقیه‌ی صفحه آرام و کاری. */


:root {
  --paper: #F5F6F4;
  --surface: #FFFFFF;
  --ink: #1C2E4A;          /* لاجوردی */
  --ink-soft: #4A5A72;
  --muted: #7A8597;
  --line: #DADED8;
  --gold: #B8862B;
  --gold-bright: #E2B65A;
  --gold-wash: #F6EEDC;
  --up: #2F7D5B;
  --down: #A23B3B;
  --focus: #2F6FB5;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.375rem;
  --fs-xl: 2.75rem;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Abar, Tahoma, sans-serif;
  font-size: var(--fs-sm);
  line-height: 1.7;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- سرصفحه */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--fs-md); }
.brand small { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.sun { width: 28px; height: 28px; flex: none; }

/* ---------- تابلوی نرخ */
.board {
  background: var(--ink);
  color: #E8ECF3;
  border-radius: var(--radius-lg);
  padding: 22px 26px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 24px;
  align-items: end;
}
.board h1 { margin: 0; font-size: var(--fs-sm); font-weight: 500; color: #B9C3D4; grid-column: 1 / -1; }
.rate { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rate input {
  background: transparent;
  border: 0;
  border-bottom: 2px solid rgba(226, 182, 90, .35);
  color: var(--gold-bright);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: .02em;
  width: 11.5ch;
  text-align: right;
  padding: 0 0 2px;
  font-variant-numeric: tabular-nums;
}
.rate input:focus-visible { outline: none; border-bottom-color: var(--gold-bright); }
.rate .unit { color: #B9C3D4; font-size: var(--fs-md); }
.board .meta { grid-column: 1 / -1; color: #9AA6BA; font-size: var(--fs-xs); }
.board .meta b { color: #D5DCE7; font-weight: 500; }
.board-actions { display: flex; gap: 10px; }

/* ---------- دکمه‌ها */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-soft); }
a.btn, label.btn { display: inline-block; text-decoration: none; color: inherit; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1B1405; font-weight: 700; }
.btn.primary:hover { background: #A7781F; }
.btn.on-dark { background: transparent; border-color: rgba(255,255,255,.28); color: #E8ECF3; }
.btn.on-dark:hover { border-color: #fff; }
.btn.danger { color: var(--down); }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- نوار پیش‌نمایش */
.preview-bar {
  margin-top: 12px;
  background: var(--gold-wash);
  border: 1px solid #E7D4AA;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.preview-bar[hidden] { display: none; }

/* ---------- زبانه‌ها */
.tabs { display: flex; gap: 4px; margin: 26px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); font-weight: 500; }
.tabs .count { font-size: var(--fs-xs); background: var(--gold-wash); color: #7A5A17; border-radius: 10px; padding: 0 7px; margin-inline-start: 4px; }
.panel { padding: 18px 0 60px; }
.panel[hidden] { display: none; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.search { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 12px; background: var(--surface); min-width: 220px; }

/* ---------- جدول محصولات */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid #EEF0EC; white-space: nowrap; }
th { font-weight: 500; color: var(--muted); font-size: var(--fs-xs); background: #FAFBF9; }
td.num, th.num { text-align: left; font-variant-numeric: tabular-nums; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover { background: #FAFAF6; }
tbody tr.inactive td { color: var(--muted); }
.price { font-weight: 700; }
.code { color: var(--muted); font-size: var(--fs-xs); }
.sku { font-family: Abar, Tahoma, sans-serif; unicode-bidi: isolate; direction: ltr; }
.field input.ltr { direction: ltr; text-align: left; font-family: Abar, Tahoma, sans-serif; }
.tag { font-size: var(--fs-xs); color: var(--muted); }
.tag.ok { color: var(--up); }
.tag.err { color: var(--down); }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.new-price { color: var(--gold); font-weight: 700; }

/* ریز قیمت */
tr.detail td { background: #FBFAF5; white-space: normal; }
.breakdown { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 22px; padding: 6px 0; }
.breakdown div { display: flex; flex-direction: column; }
.breakdown span { color: var(--muted); font-size: var(--fs-xs); }
.breakdown b { font-weight: 500; font-variant-numeric: tabular-nums; }
.breakdown .total b { font-weight: 700; }
.detail-actions { display: flex; gap: 8px; margin-top: 10px; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-soft); }

/* ---------- ماژول‌ها */
.modules { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.module { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; padding: 16px 18px; border-bottom: 1px solid #EEF0EC; }
.module:last-child { border-bottom: 0; }
.module h3 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.module p { margin: 0; color: var(--ink-soft); font-size: var(--fs-xs); max-width: 70ch; }
.module .fields { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 6px; }
.module.off .fields { opacity: .45; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--ink-soft); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--surface);
  font-size: var(--fs-sm); color: var(--ink); min-width: 120px;
}
.field input.num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--ink-soft); }

/* کلید روشن/خاموش */
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: #C9CEC6; border-radius: 13px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.save-row { display: flex; gap: 10px; margin-top: 16px; align-items: center; }

/* ---------- اسنپ‌شاپ */
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 16px; }
.section h3 { margin: 0 0 4px; font-size: var(--fs-md); }
.section > p { margin: 0 0 12px; color: var(--ink-soft); font-size: var(--fs-xs); max-width: 75ch; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: center; }
.kv dt { color: var(--muted); font-size: var(--fs-xs); }
.kv dd { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mono { direction: ltr; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-xs); background: #F2F3F0; padding: 3px 8px; border-radius: 4px; word-break: break-all; }
.note { border-inline-start: 3px solid var(--gold); padding: 6px 12px; background: var(--gold-wash); font-size: var(--fs-xs); color: #5B4512; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- پنجره‌ی محصول */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(720px, calc(100vw - 24px)); color: var(--ink); }
dialog::backdrop { background: rgba(28, 46, 74, .45); }
.dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: var(--fs-lg); }
.dlg-body { padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; max-height: 70vh; overflow: auto; }
.dlg-body .wide { grid-column: 1 / -1; }
.dlg-body .field input, .dlg-body .field select, .dlg-body .field textarea { width: 100%; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.dlg-foot .live { margin-inline-start: auto; color: var(--ink-soft); font-size: var(--fs-xs); }
.dlg-foot .live b { color: var(--ink); font-size: var(--fs-md); }
.hint { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- پیام */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--down); }

/* ---------- ورود */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); background: var(--ink); color: #E8ECF3; border-radius: var(--radius-lg); padding: 30px 28px; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: var(--fs-lg); }
.login p { margin: 0; color: #B9C3D4; font-size: var(--fs-xs); }
.login input { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); border-radius: var(--radius-sm); padding: 9px 12px; color: #fff; }
.login .err { color: #F2B8B8; }

@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; padding: 18px; }
  .rate input { font-size: 2.1rem; width: 100%; }
  .board-actions { flex-wrap: wrap; }
  .kv { grid-template-columns: 1fr; }
  .opt { display: none; }
  .toolbar .search { min-width: 0; flex: 1 1 100%; order: 5; }
  .toolbar .spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
.store-orders-list{display:grid;gap:20px}.store-order{border:1px solid var(--line,#ddd);padding:22px;background:#fff}.store-order-head{display:flex;flex-wrap:wrap;align-items:center;gap:16px}.store-order-head>span:last-child{margin-right:auto;font-size:12px;color:#777}.store-order p{font-size:13px;line-height:2}.store-order-line{display:flex;justify-content:space-between;gap:20px;border-top:1px solid #eee;padding:10px 0;font-size:13px}.product-image-library{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:15px}.library-image{border:1px solid #ddd;background:#fff;padding:8px;cursor:pointer;font:inherit}.library-image img{width:100%;height:130px;object-fit:contain}.library-image span{display:block;font-size:11px;margin-top:6px}@media(max-width:600px){.product-image-library{grid-template-columns:1fr 1fr}.store-order{padding:15px}.store-order-head>span:last-child{margin:0;width:100%}.store-order-line{font-size:11px}}
