/* Customer Portal — design system.
   Direction: precise, engineering-document feel. Solder-mask green + copper on cool paper; hairlines instead of boxes.
   No inline styles are used anywhere (strict CSP), so every variation is a class. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #F3F4F1; --surface: #FFFFFF; --sunk: #ECEEEA;
  --ink: #14202A; --ink-2: #46555F; --ink-3: #75828B;
  --line: #D9DED8; --line-2: #E9ECE7;
  --mask: #0D5B49; --mask-deep: #08382D; --mask-wash: #E2EFEA;
  --copper: #B3691F; --copper-wash: #F6EBDC;
  --danger: #B0352B; --danger-wash: #F8E5E2; --ok: #1E7B4E; --ok-wash: #E1F1E8;
  --side: #101B23; --side-ink: #C5D0D6; --side-dim: #7E8E98;
  --r: 6px; --gap: 16px;
  --font: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root { color-scheme: light; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14.5px/1.85 var(--font); color: var(--ink); background: var(--paper); direction: rtl; text-align: right; }
a { color: var(--mask); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.4; }
h1 { font-size: 22px; letter-spacing: -.2px; } h2 { font-size: 16px; } h3 { font-size: 14.5px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); } .small { font-size: 12.5px; } .num { font-feature-settings: "tnum"; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; border-radius: 3px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 0 14px; }
.brand { padding: 0 20px 18px; border-bottom: 1px solid #22313B; display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand b { display: block; color: #fff; font-size: 15px; line-height: 1.3; } .brand span { font-size: 11.5px; color: var(--side-dim); }
.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 2px; color: var(--side-ink); border-radius: var(--r); font-size: 14px; position: relative; }
.nav a:hover { background: #18262F; text-decoration: none; color: #fff; }
.nav a.on { background: #1A2A33; color: #fff; }
.nav a.on::before { content: ""; position: absolute; right: -10px; top: 8px; bottom: 8px; width: 3px; background: var(--copper); border-radius: 3px 0 0 3px; }
.nav svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav .badge-n { margin-right: auto; background: var(--copper); color: #fff; border-radius: 10px; font-size: 11px; min-width: 20px; text-align: center; padding: 0 6px; line-height: 20px; }
.nav-sep { height: 1px; background: #22313B; margin: 10px 4px; }
.side-foot { padding: 12px 20px 0; border-top: 1px solid #22313B; font-size: 12px; color: var(--side-dim); }
.side-foot b { color: var(--side-ink); font-weight: 600; display: block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .grow { flex: 1; }
.menu-btn { display: none; }
.fresh { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 11px 4px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink-2); }
.fresh i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: block; }
.fresh.warn { background: var(--copper-wash); border-color: #E6CFAE; color: #7C4710; } .fresh.warn i { background: var(--copper); }
.fresh.bad { background: var(--danger-wash); border-color: #E8BDB7; color: #86261D; } .fresh.bad i { background: var(--danger); }
.icon-btn { position: relative; border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--paper); text-decoration: none; } .icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: -5px; left: -5px; background: var(--copper); color: #fff; font-size: 10.5px; min-width: 18px; line-height: 18px; border-radius: 9px; text-align: center; padding: 0 4px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mask-wash); color: var(--mask-deep); display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who small { display: block; line-height: 1.4; color: var(--ink-3); font-size: 12px; } .who b { display: block; line-height: 1.4; font-size: 13.5px; }
.content { padding: 26px 28px 60px; width: 100%; max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; } .crumbs a { color: var(--ink-3); }

/* ---------- primitives ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.panel-b { padding: 18px; }
.grid { display: grid; gap: var(--gap); } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: var(--gap); }
.btn { font: inherit; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--mask); background: var(--mask); color: #fff; cursor: pointer; line-height: 1.6; }
.btn:hover { background: var(--mask-deep); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); } .btn.ghost:hover { background: var(--paper); }
.btn.danger { background: var(--danger); border-color: var(--danger); } .btn.sm { padding: 4px 11px; font-size: 12.5px; } .btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink-2); white-space: nowrap; line-height: 1.7; }
.badge.ok { background: var(--ok-wash); color: #14603B; } .badge.warn { background: var(--copper-wash); color: #7C4710; }
.badge.bad { background: var(--danger-wash); color: #86261D; } .badge.mask { background: var(--mask-wash); color: var(--mask-deep); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--sunk); display: block; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--sunk); } progress::-webkit-progress-value { background: var(--mask); } progress::-moz-progress-bar { background: var(--mask); }
progress.cu::-webkit-progress-value { background: var(--copper); } progress.cu::-moz-progress-bar { background: var(--copper); }
.pbar { display: flex; align-items: center; gap: 10px; min-width: 130px; } .pbar span { font-size: 12.5px; min-width: 38px; text-align: left; color: var(--ink-2); }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; } .field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); }
.input:focus { outline: none; border-color: var(--mask); box-shadow: 0 0 0 3px var(--mask-wash); } textarea.input { min-height: 110px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pw { position: relative; } .pw .input { padding-left: 62px; } .pw button { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--mask); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 8px; }
.drop { border: 1.5px dashed #B7C0B8; border-radius: var(--r); padding: 14px; background: var(--paper); font-size: 13px; color: var(--ink-2); }
.drop input { display: block; margin-top: 6px; max-width: 100%; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: right; font-weight: 600; font-size: 12.5px; color: var(--ink-3); padding: 10px 18px; border-bottom: 1px solid var(--line); background: #FAFBF9; white-space: nowrap; }
.t td { padding: 12px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; } .t tbody tr:hover td { background: #FAFBF8; }
.t .id { font-weight: 700; color: var(--ink); } .t td.r, .t th.r { text-align: left; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }
.pager a, .pager span.cur { display: inline-block; min-width: 32px; text-align: center; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r); margin-right: 4px; color: var(--ink); background: #fff; }
.pager span.cur { background: var(--mask); border-color: var(--mask); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: center; }
.filters .input { width: auto; min-width: 150px; } .filters .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 16px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: 13.5px; }
.tabs a.on { color: var(--mask-deep); border-color: var(--copper); } .tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- ledger KPI strip (hairlines, not cards) ---------- */
.ledger { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ledger > div { padding: 16px 20px; border-left: 1px solid var(--line-2); } .ledger > div:last-child { border-left: 0; }
.ledger .k { font-size: 12.5px; color: var(--ink-3); } .ledger .v { font-size: 27px; font-weight: 700; line-height: 1.35; letter-spacing: -.3px; }
.ledger .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-right: 4px; } .ledger .s { font-size: 12px; color: var(--ink-3); }

/* ---------- trace-line stepper: the order route, drawn like a PCB trace ---------- */
.trace { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; padding-top: 4px; }
.trace .st { position: relative; text-align: center; font-size: 12.5px; color: var(--ink-3); padding-top: 26px; }
.trace .st::before { content: ""; position: absolute; top: 9px; right: 0; left: 0; height: 3px; background: var(--line); }
.trace .st:first-child::before { right: 50%; } .trace .st:last-child::before { left: 50%; }
.trace .st::after { content: ""; position: absolute; top: 3px; right: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.trace .st.done { color: var(--mask-deep); } .trace .st.done::before { background: var(--mask); } .trace .st.done::after { background: var(--mask); border-color: var(--mask); }
.trace .st.cur { color: var(--ink); font-weight: 700; } .trace .st.cur::before { background: linear-gradient(to left, var(--mask) 50%, var(--line) 50%); }
.trace .st.cur::after { border-color: var(--copper); background: #fff; box-shadow: 0 0 0 4px var(--copper-wash); }
.trace.sm { padding-top: 0; } .trace.sm .st { font-size: 11.5px; padding-top: 22px; }
.trace.closed .st::before, .trace.closed .st::after { background: var(--sunk); border-color: var(--line); }

/* ---------- misc blocks ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 0; font-size: 13.5px; } .kv dt, .kv dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line-2); } .kv dt { color: var(--ink-3); } .kv dd:last-of-type, .kv dt:last-of-type { border-bottom: 0; }
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); } .empty svg { width: 44px; height: 44px; stroke: var(--line); margin-bottom: 8px; } .empty b { display: block; color: var(--ink-2); font-size: 15px; }
.flash { padding: 11px 16px; border-radius: var(--r); margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.flash.ok { background: var(--ok-wash); border-color: #BFDECC; color: #14603B; } .flash.err { background: var(--danger-wash); border-color: #EBC3BE; color: #86261D; } .flash.info { background: var(--mask-wash); border-color: #C3DCD3; color: var(--mask-deep); }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 30px 20px 0; } .timeline li::before { content: ""; position: absolute; right: 7px; top: 8px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; } .timeline li::after { content: ""; position: absolute; right: 2px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2.5px solid var(--mask); }
.timeline li.t-order_status::after, .timeline li.t-shipment_sent::after { border-color: var(--copper); }
.timeline .when { font-size: 12px; color: var(--ink-3); } .timeline .ttl { font-weight: 600; }
.bubble-list { display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 82%; padding: 11px 15px; border-radius: 10px; background: #fff; border: 1px solid var(--line); } .bubble .by { font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.bubble.me { align-self: flex-start; background: var(--mask-wash); border-color: #C3DCD3; } .bubble.co { align-self: flex-end; } .bubble pre { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; }
.files a { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; margin: 2px 0 2px 6px; font-size: 12.5px; background: #fff; }
.list-link { display: block; padding: 13px 18px; border-bottom: 1px solid var(--line-2); color: inherit; } .list-link:hover { background: #FAFBF8; text-decoration: none; } .list-link:last-child { border-bottom: 0; }
.list-link.unread b { color: var(--mask-deep); }
.chart-bars rect { fill: var(--mask); } .chart-bars rect.cu { fill: var(--copper); } .chart-bars text { font: 11px var(--font); fill: var(--ink-3); } .chart-bars line { stroke: var(--line-2); }
.donut circle { fill: none; stroke-width: 15; } .legend { list-style: none; padding: 0; margin: 0; font-size: 13px; } .legend li { display: flex; gap: 9px; align-items: center; padding: 3px 0; } .legend i { width: 10px; height: 10px; border-radius: 2px; display: block; flex: none; }
.c0 { background: var(--mask); stroke: var(--mask); } .c1 { background: var(--copper); stroke: var(--copper); } .c2 { background: #5E8C80; stroke: #5E8C80; } .c3 { background: #C9A36B; stroke: #C9A36B; } .c4 { background: #8A9AA3; stroke: #8A9AA3; } .c5 { background: #B0352B; stroke: #B0352B; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art { background: var(--mask-deep); color: #D8EBE5; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art svg.traces { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; } .auth-art svg.traces path { fill: none; stroke: #1B7A63; stroke-width: 2; } .auth-art svg.traces circle { fill: #0F5445; stroke: #2E9A80; stroke-width: 2; }
.auth-art > * { position: relative; } .auth-art h2 { color: #fff; font-size: 26px; line-height: 1.7; max-width: 420px; } .auth-art p { max-width: 420px; color: #9CC4B8; }
.auth-art .brand { border: 0; padding: 0; } .auth-art .brand b { font-size: 17px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; } .auth-card { width: 100%; max-width: 390px; }
.auth-card h1 { margin-bottom: 6px; } .auth-card > p { color: var(--ink-3); margin-bottom: 24px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .ledger { grid-template-columns: repeat(3, 1fr); } .ledger > div { border-bottom: 1px solid var(--line-2); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .side { position: fixed; right: 0; top: 0; width: 270px; z-index: 40; transform: translateX(100%); transition: transform .2s; } .side.open { transform: none; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(10, 18, 24, .5); z-index: 30; } .scrim.open { display: block; }
  .menu-btn { display: grid; } .content { padding: 18px 14px 50px; } .top { padding: 10px 14px; } .who div { display: none; }
  .g2, .g3, .row { grid-template-columns: 1fr; } .ledger { grid-template-columns: 1fr 1fr; } .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .kv { grid-template-columns: 110px 1fr; } .fresh .lbl-long { display: none; } .bubble { max-width: 94%; }
}
@media print { .side, .top, .btn, .filters { display: none !important; } .shell { display: block; } body { background: #fff; } }

/* ---------- dashboard specifics ---------- */
.stack-m { margin-bottom: 18px; } .dash-gap { align-items: start; }
.trace-cell { min-width: 280px; } .donut-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; } .donut-row .legend { flex: 1; min-width: 150px; } .legend b { margin-right: auto; }
.dist { margin-bottom: 12px; } .dist-l { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 10px; } .dist-l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-fill { border-top: 1px solid var(--line-2); } .fill-l { margin-bottom: 6px; }
.up-form { margin-top: 14px; display: grid; gap: 8px; } .reply-form { border-top: 1px solid var(--line-2); } .who-big { margin-bottom: 12px; } .avatar.big { width: 56px; height: 56px; font-size: 22px; } .perm-chip { margin: 2px 0; }
