/* فونت وزیرمتن (همان فونت سایت دیگ‌محلی) — فایل‌ها داخل خود پروژه */
@font-face {
  font-family: 'Vazirmatn Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url('fonts/vazirmatn-arabic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}
@font-face {
  font-family: 'Vazirmatn Variable'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url('fonts/vazirmatn-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --bg: #eef2f9;
  --surface: #fff;
  --line: #dbe2ef;
  --text: #14213d;
  --muted: #6b7686;
  --brand: #0a4390;
  --brand-dark: #062a5e;
  --brand-light: #2f7fd8;
  --brand-soft: #e6ecfa;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn Variable", Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

button, input, select, textarea { font: inherit; color: inherit; line-height: 1.6; }

/* نوار بالا */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 4px; }
.nav a, .nav span { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .soon { opacity: .5; cursor: default; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px 40px; }

.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.banner.ok  { background: #e2f5e9; border-color: #a9dcbc; color: #14562d; }
.banner.info { background: var(--brand-soft); border-color: #b9c8ee; color: var(--brand-dark); }
.banner.err { background: #fde8e8; border-color: #f2b8b8; color: #8c1c1c; }

.sync-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.sync-btn:hover { background: var(--brand-dark); }
.sync-btn:disabled { opacity: .75; cursor: progress; }
.sync-btn .spin { display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgb(255 255 255 / .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.sync-btn.busy .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* صفحهٔ تنظیمات */
.container.narrow { max-width: 620px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; transition: border-color .3s, box-shadow .3s;
}
.panel.connected { border-color: #2e9e5b; box-shadow: 0 0 0 3px #e2f5e9; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h1 { font-size: 18px; margin: 0; }

.conn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.conn i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.conn.untested { background: #eef1f5; color: #6b7686; }
.conn.ok       { background: #e2f5e9; color: #177a3e; }
.conn.failed   { background: #fde8e8; color: #b42323; }
.conn.testing  { background: #fff1dc; color: #a45a00; }
.conn.testing i { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.field input[dir=ltr] { text-align: left; }
.field input::placeholder { text-align: right; direction: rtl; color: #9aa4b2; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn .spin { display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #c9d2de; border-top-color: var(--brand); animation: spin .8s linear infinite; }
.btn.busy .spin { display: block; }
.panel .banner { margin: 4px 0 16px; }

/* کارت‌های خلاصه */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0;
}
.card span { display: block; color: var(--muted); font-size: 12.5px; }
.card i { font-style: normal; opacity: .7; }
.card b { font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.card.warn b { color: #b4530a; }

/* فیلترها */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  height: 40px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.toolbar input { flex: 1 1 280px; min-width: 0; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.segmented { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented button { border: 0; background: none; padding: 0 14px; height: 38px; cursor: pointer; color: var(--muted); }
.segmented button.active { background: var(--brand); color: #fff; }

/* جدول */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: right; white-space: nowrap; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid #eef1f5; }
tbody tr:last-child td { border-bottom: 0; }
#rows tr { cursor: pointer; }
#rows tr:hover { background: #f7fafd; }
.num { text-align: left; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; margin: 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.b-registered { background: #eef1f5; color: #4a5565; }
.b-confirmed  { background: #e7f0fa; color: #0b5cad; }
.b-processing { background: #fff1dc; color: #a45a00; }
.b-shipped    { background: #ece8fb; color: #5a3fc0; }
.b-delivered, .b-paid { background: #e2f5e9; color: #177a3e; }
.b-canceled, .b-unpaid { background: #fde8e8; color: #b42323; }
.b-partial    { background: #fff1dc; color: #a45a00; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; color: var(--muted); }
.pager button {
  height: 36px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
}
.pager button:disabled { opacity: .4; cursor: default; }

/* کشوی جزئیات سفارش */
.drawer {
  margin: 0; inset: 0 auto 0 0; height: 100dvh; max-height: none;
  width: min(760px, 100vw); max-width: none; border: 0; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 8px 0 40px rgb(0 0 0 / .18);
}
.drawer::backdrop { background: rgb(15 23 35 / .45); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface);
}
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head button { border: 0; background: none; font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.drawer-head button:hover { background: var(--bg); }
.drawer-body { padding: 18px 20px 28px; }
.drawer-body h3 { font-size: 14px; margin: 22px 0 8px; }

.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin: 0; }
.fields div { min-width: 0; }
.fields dt { color: var(--muted); font-size: 12px; }
.fields dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.note { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }

.items { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.items td, .items th { padding: 8px 10px; font-size: 13px; }
.items td.name { white-space: normal; min-width: 150px; }

.totals { margin: 14px 0 0 auto; width: min(340px, 100%); margin-inline-start: auto; margin-inline-end: 0; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 15px; }
.totals .due { color: #b4530a; font-weight: 600; }

@media (max-width: 800px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .fields { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 10px 14px; }
  .container { padding: 14px; }
  .nav .soon { display: none; }
}

/* مرتب‌سازی و فیلتر ستون‌ها */
th button.sort {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
th button.sort:hover, th button.sort.active { color: var(--brand); }
th button.sort .arrow { font-size: 9px; width: 9px; }
tr.filters th { padding: 6px 8px; background: var(--surface); }
tr.filters input, tr.filters select {
  width: 100%; min-width: 84px; height: 30px; padding: 0 8px; font-size: 12.5px; font-weight: 400;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; outline: none;
}
tr.filters input:focus, tr.filters select:focus { border-color: var(--brand); background: var(--surface); }
.toolbar .btn { height: 40px; padding: 0 14px; }

[hidden] { display: none !important; }

/* انتخاب پنل (شعبه) در نوار بالا */
.panel-select {
  display: block; min-width: 190px; max-width: 280px; height: 30px; padding: 0 8px; margin-bottom: 2px;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; outline: none; cursor: pointer;
}
.panel-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.banner a { color: inherit; font-weight: 600; }

/* صفحهٔ تنظیمات: فهرست پنل‌ها + فرم */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.panel-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.panel-item.connected { border-color: #2e9e5b; background: #f6fcf8; }
.panel-item.editing { box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
.panel-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-item-head strong { font-size: 15px; }
.panel-item-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.panel-item-error { color: #b42323; font-size: 12.5px; margin-top: 6px; }
.panel-item-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: #b42323; }
.btn.danger:hover { background: #fde8e8; }
.field input[readonly] { background: var(--bg); color: var(--muted); }
.actions { flex-wrap: wrap; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

/* منوی کاربر */
.topbar-end { display: flex; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.menu-button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.menu-button:hover { background: var(--bg); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700;
}
.avatar { overflow: hidden; }
.avatar svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.menu-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.caret { color: var(--muted); font-size: 11px; }
.menu-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(20 30 50 / .14); z-index: 20;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head small { color: var(--muted); font-size: 12px; }
.menu-item {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  text-align: right; text-decoration: none; color: var(--text); cursor: pointer;
}
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: #b42323; }
.menu-item.danger:hover { background: #fde8e8; }

/* صفحهٔ ورود */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; font-size: 16px; }
.login-box h1 { font-size: 18px; margin: 0 0 16px; }
.muted { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.btn.wide { width: 100%; justify-content: center; height: 42px; }

/* کاربران و پروفایل */
.field select {
  width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
fieldset.field { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin-inline: 0; }
fieldset.field legend { font-weight: 600; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.checks .check { margin-bottom: 6px; }
.fields.two { grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
.fields dd[dir=ltr] { text-align: right; }
.btn.danger:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .menu-name { display: none; }
}

/* ───── تم آبی (برگرفته از لوگو) ───── */
.topbar {
  background: linear-gradient(100deg, var(--brand-dark), var(--brand) 55%, #1560bd);
  border-bottom: 0; color: #fff; box-shadow: 0 2px 12px rgb(14 36 104 / .25);
}
.topbar .brand-mark { background: #fff; color: var(--brand); overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar .brand strong { color: #fff; }
.topbar .brand small { color: rgb(255 255 255 / .75); }
.topbar .nav a, .topbar .nav span { color: rgb(255 255 255 / .8); }
.topbar .nav a:hover { background: rgb(255 255 255 / .12); color: #fff; }
.topbar .nav a.active { background: #fff; color: var(--brand); }
.topbar .panel-select { background-color: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .3); color: #fff; }
.topbar .panel-select option { color: var(--text); background: #fff; }
.topbar .sync-btn { background: #fff; color: var(--brand); }
.topbar .sync-btn:hover { background: var(--brand-soft); }
.topbar .sync-btn .spin { border-color: rgb(23 56 154 / .25); border-top-color: var(--brand); }
.topbar .menu-button { background: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .3); color: #fff; }
.topbar .menu-button:hover { background: rgb(255 255 255 / .2); }
.topbar .avatar { background: #fff; }
.topbar .caret { color: rgb(255 255 255 / .8); }
.menu-dropdown { color: var(--text); }
.card { border-top: 3px solid var(--brand-light); }
.panel-head h1 { color: var(--brand-dark); }
thead th { background: #f3f6fd; }
a { color: var(--brand); }

/* صفحهٔ ورود */
.login-page {
  background:
    radial-gradient(900px 500px at 85% -10%, rgb(47 127 216 / .55), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgb(47 127 216 / .35), transparent 60%),
    linear-gradient(160deg, var(--brand-dark), var(--brand));
}
.login-box { max-width: 420px; }
.login-card {
  background: var(--surface); border-radius: 20px; padding: 0 32px 28px;
  box-shadow: 0 24px 60px rgb(5 16 56 / .45);
}
.login-logo {
  width: 104px; height: 104px; margin: 0 auto; transform: translateY(-36px); margin-bottom: -22px;
  border-radius: 24px; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--brand-light), var(--brand)); color: #fff; font-size: 44px; font-weight: 800;
  border: 4px solid #fff; box-shadow: 0 10px 24px rgb(14 36 104 / .35);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-card h1 { text-align: center; font-size: 19px; margin: 0; color: var(--brand-dark); }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 0 20px; }
.login-card .muted { margin: 0 0 16px; text-align: center; }
.login-card .field input { height: 44px; }
.login-foot { text-align: center; color: rgb(255 255 255 / .7); font-size: 12px; margin-top: 18px; }

/* ───── صفحه‌های داخلی تمام‌عرض ───── */
.container { max-width: none; padding: 18px 24px 32px; }
.settings-grid { grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.cards { gap: 14px; }

/* ───── ارتفاع فیلدها: متن فارسی کامل دیده شود ───── */
input, select { box-sizing: border-box; padding-block: 0; }
select { text-overflow: ellipsis; }
.field input, .field select, .toolbar input, .toolbar select { height: 44px; }
.btn, .btn.wide, .toolbar .btn, .sync-btn, .menu-button { height: 44px; }
.btn.small { height: 36px; }
.segmented button { height: 42px; }
.pager button { height: 40px; }
tr.filters input, tr.filters select { height: 38px; font-size: 13px; min-width: 96px; padding-inline: 10px; }
.panel-select { height: 38px; padding-inline: 10px; min-width: 210px; }
th, td { padding-block: 12px; }
th { font-size: 13px; }
.badge { padding: 3px 12px; line-height: 1.7; }
.conn { padding: 5px 12px; line-height: 1.6; }

/* لوگوی ایران‌خودرو */
.login-card { padding-top: 26px; }
.login-logo.has-img {
  width: 190px; height: auto; transform: none; margin: 0 auto 10px; border: 0; border-radius: 0;
  background: none; box-shadow: none; display: block;
}
.login-logo.has-img img { height: auto; object-fit: contain; }
.topbar .brand-mark { padding: 3px; }
.brand-mark img { object-fit: contain; }

/* ستون «ردیف» و ستون بله/خیر در جدول سفارش‌ها */
th.rownum, td.rownum { width: 1%; text-align: center; color: var(--muted); white-space: nowrap; }
td.center { text-align: center; color: var(--brand); font-weight: 700; }

/* ───── مرحلهٔ درخواست در سطر جدول ───── */
.expander-cell { width: 1%; padding-inline: 10px 0; }
.expander {
  width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  color: var(--brand); font-size: 17px; font-weight: 700; line-height: 1; cursor: pointer;
}
.expander:hover { background: var(--brand-soft); }
#rows tr.main.open { background: #f3f6fd; }
.stage-box { display: flex; align-items: center; gap: 10px; }
.stage-bar { display: flex; gap: 3px; margin-bottom: 4px; }
.stage-bar i { width: 15px; height: 6px; border-radius: 3px; background: #dfe5ee; }
.stage-bar i.done { background: #2e9e5b; }
.stage-label { font-size: 12.5px; font-weight: 600; color: #a45a00; }
.delivered .stage-label, .stage-label.delivered { color: #177a3e; }
.canceled .stage-label, .stage-label.canceled { color: #b42323; }
.canceled .stage-bar i.done { background: #c9a3a3; }
.unknown .stage-label, .stage-label.unknown { color: var(--muted); font-weight: 400; }
.chip {
  display: inline-flex; flex-direction: column; padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 12.5px; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.chip small { font-size: 11px; font-weight: 400; color: var(--muted); }

/* ───── تب‌های تکمیلی زیر سطر ───── */
#rows tr.expand-row, #rows tr.expand-row tr { cursor: default; }
#rows tr.expand-row:hover, #rows tr.expand-row tr:hover { background: none; }
tr.expand-row > td { padding: 0; background: #f7f9fd; border-bottom: 2px solid var(--line); white-space: normal; }
.expand {
  position: sticky; inset-inline-start: 0; width: calc(100vw - 68px); max-width: 1500px;
  padding: 16px 18px 18px;
}
.track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 14px; }
.step { text-align: center; font-size: 12.5px; color: var(--muted); position: relative; }
.step b {
  display: grid; place-items: center; width: 26px; height: 26px; margin: 0 auto 4px; border-radius: 50%;
  background: #e3e8f0; color: var(--muted); font-size: 12.5px; position: relative; z-index: 1;
}
.step::before { content: ''; position: absolute; top: 12px; inset-inline: -50% 50%; height: 2px; background: #e3e8f0; }
.step:first-child::before { display: none; }
.step.done { color: var(--text); }
.step.done b { background: #2e9e5b; color: #fff; }
.step.done::before { background: #2e9e5b; }
.step.next b { background: #fff1dc; color: #a45a00; box-shadow: 0 0 0 2px #f0c988; }
.step.next { color: #a45a00; font-weight: 600; }
.track.canceled .step.done b, .track.canceled .step.done::before { background: #c9a3a3; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.facts .stage-label { font-size: 14px; margin-inline-end: 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0; background: none; cursor: pointer;
  padding: 7px 14px; font-weight: 600; color: var(--text); margin-bottom: -1px;
}
.tabs button.blank { color: #9aa4b2; font-weight: 400; }
.tabs button:hover { background: var(--brand-soft); }
.tabs button.active { background: var(--surface); border-color: var(--line); color: var(--brand); }
.tab-body {
  background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 14px;
}
.tab-body .items + .items { margin-top: 10px; }
.tab-body .items { max-height: 420px; overflow: auto; }
.tab-body .note { margin: 0; }
.tab-body tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 800px) {
  .expand { width: calc(100vw - 30px); padding: 12px; }
  .step span { font-size: 11px; }
}

/* ───── پنل دریافت از ایساکو (بالای صفحهٔ سفارش‌ها) ───── */
.sync-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 16px;
}
.sync-field { display: flex; align-items: center; gap: 8px; position: relative; }
.datepicker {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 10; width: 284px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(20 30 50 / .16); cursor: default;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head strong { font-size: 14.5px; color: var(--brand-dark); }
.dp-nav {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: 18px; line-height: 1; cursor: pointer; color: var(--brand);
}
.dp-nav:hover { background: var(--brand-soft); }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.sync-field .dp-week span { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.sync-field .dp-week span:last-child { color: #c0392b; }
.sync-field .dp-grid span { margin: 0; }
.dp-day {
  height: 34px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; font-size: 13.5px;
}
.dp-day:hover { background: var(--brand-soft); }
.dp-day.friday { color: #c0392b; }
.dp-day.today { border-color: var(--brand-light); font-weight: 700; }
.dp-day.selected, .dp-day.selected:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.sync-field > span { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sync-field input {
  width: 150px; height: 44px; padding: 0 12px; text-align: center; letter-spacing: .5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.sync-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sync-field input.invalid { border-color: #d64545; box-shadow: 0 0 0 3px #fde8e8; }
.sync-field input:disabled { background: var(--bg); color: var(--muted); }
@media (max-width: 560px) {
  .sync-field { flex: 1 1 100%; }
  .sync-field input { flex: 1; width: auto; min-width: 0; }
  .sync-panel .sync-btn { flex: 1 1 100%; justify-content: center; }
}

/* ───── منوی «ستون‌ها» ───── */
.col-menu { position: relative; }
.col-list { min-width: 200px; max-height: 60vh; overflow-y: auto; padding: 8px; }
.col-list .check { margin: 0; padding: 4px 6px; border-radius: 6px; }
.col-list .check:hover { background: var(--bg); }
.col-list .menu-item { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0; color: var(--brand); font-weight: 600; }

/* ───── نوار اسکرول افقی بالای جدول ───── */
.top-scroll {
  overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 4px;
  position: sticky; top: var(--topbar-h, 64px); z-index: 4; background: var(--bg);
}
.top-scroll > div { height: 1px; }
.table-wrap { scrollbar-width: none; }
.table-wrap::-webkit-scrollbar { display: none; }
.expand { width: var(--wrap-w, calc(100vw - 68px)); max-width: none; }

/* ───── چیدمان فشرده: اطلاعات بیشتر در یک صفحه ───── */
.container { padding: 10px 14px 20px; }
.sync-panel { padding: 6px 12px; margin-bottom: 8px; gap: 8px 14px; }
.sync-field input, .sync-btn, .toolbar input, .toolbar select, .toolbar .btn { height: 34px; }
.sync-field input { width: 130px; }
.sync-btn { padding: 0 14px; }
.banner { padding: 6px 12px; margin-bottom: 8px; }

/* کارت‌های خلاصه: یک نوار باریک به‌جای چهار کادر بلند */
.cards { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 8px; padding: 0 4px; }
.card { display: flex; align-items: baseline; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none; }
.card span { font-size: 12.5px; }
.card b { font-size: 15px; }

.toolbar { gap: 8px; margin-bottom: 6px; }
.segmented button { height: 32px; padding: 0 12px; }

/* جدول: فاصله‌های کمتر، خط‌های کمتر */
th, td { padding: 5px 8px; font-size: 13px; }
th { font-size: 12px; padding-block: 6px; border-bottom: 0; }
thead th { background: #f3f6fd; }
tr.filters th { padding: 0 3px 5px; background: #f3f6fd; border-bottom: 1px solid var(--line); }
tr.filters input, tr.filters select {
  height: 26px; min-width: 64px; font-size: 12px; padding-inline: 6px; border-radius: 6px; background: var(--surface);
}
td { border-bottom-color: #f0f3f8; }
.badge { padding: 0 8px; font-size: 12px; line-height: 1.75; }
.expander { width: 22px; height: 22px; font-size: 15px; border-radius: 6px; }
.expander-cell { padding-inline: 8px 0; }
.stage-box { gap: 8px; }
.stage-bar { margin-bottom: 2px; }
.stage-bar i { width: 11px; height: 5px; }
.stage-label { font-size: 12px; }
.chip { border: 0; background: #f1f4f9; padding: 1px 8px; font-size: 12px; line-height: 1.45; }
.chip small { font-size: 10.5px; }
.facts .chip { background: var(--surface); }
.pager { margin-top: 8px; gap: 10px; font-size: 13px; }
.pager button { height: 32px; padding: 0 14px; }
.expand { padding: 12px 14px 14px; }
.tab-body { padding: 10px; }
.col-list .check { display: flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; }
.col-list input[type=checkbox] { flex: none; width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--brand); }
.chip { flex-direction: row; align-items: baseline; gap: 5px; white-space: nowrap; }

/* ───── ردیف جست‌وجو: جست‌وجوی کوتاه، تیکِ دسته‌ها و فیلتر تاریخ درخواست ───── */
.toolbar { align-items: center; }
.toolbar #q { flex: 0 1 220px; }
.tool-group {
  display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 34px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.tool-group .check { margin: 0; gap: 6px; font-size: 13px; white-space: nowrap; }
.toolbar input[type=checkbox] { flex: none; width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--brand); }
.tool-group .sync-field input { flex: none; width: 104px; height: 28px; padding: 0 6px; border-radius: 7px; font-size: 13px; }
.toolbar .col-menu { margin-inline-start: auto; }
.tool-group .check small { color: var(--muted); font-size: 11.5px; }

/* ───── زبانه‌های مرحله کنار جدول: خاموش = کم‌رنگ؛ روشن = رنگی و کمی به سمت جدول (چپ) ───── */
.data-area { display: flex; align-items: flex-start; }
.data-main { flex: 1 1 0; min-width: 0; }
.stage-tabs {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 178px; padding-top: 18px;
  position: sticky; top: calc(var(--topbar-h, 64px) + 8px); z-index: 3;
}
.stage-tab {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - 10px); height: 34px;
  padding: 0 10px; font: inherit; font-size: 12.5px; text-align: start; white-space: nowrap; cursor: pointer;
  color: var(--muted); background: #eef1f6; border: 1px solid var(--line); border-radius: 0 9px 9px 0; opacity: .6;
  transition: transform .15s ease, opacity .15s ease, background .15s ease, color .15s ease;
}
.stage-tab:hover { opacity: .9; }
.stage-tab b { min-width: 24px; padding: 0 6px; font-size: 11.5px; font-weight: 600; text-align: center; border-radius: 9px; background: rgb(0 0 0 / .07); }
.stage-tab.active {
  opacity: 1; color: #fff; font-weight: 600; background: var(--brand); border-color: var(--brand);
  transform: translateX(-10px); box-shadow: 0 2px 8px rgb(20 30 50 / .18);
}
.stage-tab.active b { background: rgb(255 255 255 / .22); }
.stage-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 900px) {
  .data-area { flex-direction: column; align-items: stretch; }
  .stage-tabs { position: static; flex-direction: row; width: auto; padding: 0 0 6px; overflow-x: auto; }
  .stage-tab { flex: none; width: auto; border-radius: 9px; }
  .stage-tab.active { transform: none; }
}

/* ───── فیلتر چندانتخابیِ سرستون «مرحله» ───── */
tr.filters .multi-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; min-width: 150px; height: 26px;
  padding: 0 6px; font: inherit; font-size: 12px; font-weight: 400; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
tr.filters .multi-btn i { font-style: normal; color: var(--muted); }
tr.filters .multi-btn.active { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.multi-menu {
  position: fixed; z-index: 40; min-width: 240px; max-height: 70vh; overflow-y: auto; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgb(20 30 50 / .16);
}
.multi-menu .check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 6px; border-radius: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.multi-menu .check:hover { background: var(--bg); }
.multi-menu .check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.multi-menu .check small { margin-inline-start: auto; padding-inline-start: 14px; color: var(--muted); }
.multi-menu .menu-item {
  display: block; width: 100%; margin-top: 6px; padding: 7px 6px 3px; font: inherit; font-size: 13px; font-weight: 600; text-align: start;
  color: var(--brand); background: none; border: 0; border-top: 1px solid var(--line); cursor: pointer;
}

/* ───── زبانه‌های مرحله به شکل برچسب فلشی رنگی: هر مرحله رنگ خودش؛ خاموش = کم‌رنگ، روشن = رنگ کامل ───── */
.stage-tab.w0 { --tab: #29a9d6; }
.stage-tab.w1 { --tab: #ffa41f; }
.stage-tab.w2 { --tab: #f5d90a; }
.stage-tab.w3 { --tab: #ff3f8e; }
.stage-tab.w4 { --tab: #9bd22d; }
.stage-tab.w5 { --tab: #a877f2; }
.stage-tab.w6 { --tab: #1fc7a6; }
.stage-tabs { gap: 7px; width: 190px; }
.stage-tab {
  height: 36px; padding: 0 10px 0 24px; border: 0; border-radius: 0; opacity: 1; color: #5b6472;
  background: color-mix(in srgb, var(--tab) 20%, #fff);
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 50%); /* نوکِ فلش رو به جدول */
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.stage-tab:hover { opacity: 1; background: color-mix(in srgb, var(--tab) 38%, #fff); }
.stage-tab b { background: rgb(255 255 255 / .6); color: inherit; }
.stage-tab.active {
  color: #1b2430; font-weight: 700; background: var(--tab); border: 0; box-shadow: none; transform: translateX(-10px);
}
.stage-tab.active b { background: rgb(255 255 255 / .55); }
.stage-tab:focus-visible { outline: 0; text-decoration: underline; }
@media (max-width: 900px) {
  .stage-tabs { width: auto; }
  .stage-tab { border-radius: 0; }
  .stage-tab.active { transform: none; }
}

/* ستون متن بلند (آدرس تحویل): یک خط، ادامه با «…» و متن کامل در راهنمای موس */
td.long { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
