@font-face { font-family: 'Vazirmatn'; src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0B0D10;
  --surface: #14171C;
  --surface-2: #1B2027;
  --surface-3: #222833;
  --border: #303640;
  --text: #F5F7FA;
  --text-2: #A7B0BB;
  --text-3: #7A838E;
  --accent: #E53935;
  --accent-hover: #F0524E;
  --accent-soft: rgba(229, 57, 53, .14);
  --success: #27AE60;
  --success-soft: rgba(39, 174, 96, .15);
  --warning: #F2B84B;
  --warning-soft: rgba(242, 184, 75, .15);
  --error: #F04438;
  --info: #5B9BF0;
  --info-soft: rgba(91, 155, 240, .15);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --sidebar: 248px;
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.ic { width: 20px; height: 20px; flex: none; }
a.stat, a.list-item, a.title { text-decoration: none; color: inherit; }
a.stat:hover { border-color: #46505d; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───── چیدمان ───── */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-mark .ic { width: 22px; height: 22px; color: #fff; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.2px; }
.brand-sub { font-size: .78rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2);
  text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-size: .85rem; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; flex: none; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: rgba(11, 13, 16, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 24px 28px 48px; max-width: 1280px; }
.banner { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }
.banner.warn { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(242, 184, 75, .35); }
.banner.info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(91, 155, 240, .3); }

.bottom-nav { display: none; }
.scrim { display: none; }
.mobile-only { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 0 0 auto; width: min(300px, 86vw); z-index: 60; transform: translateX(105%); transition: transform .2s;
    box-shadow: var(--shadow);
  }
  .layout.drawer-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 55; }
  .layout.drawer-open .scrim { display: block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 96px; }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--text-2); text-decoration: none;
    background: none; border: 0; padding: 4px 0; cursor: pointer;
  }
  .bottom-nav .ic { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--text); }
  .bottom-nav a.active svg { color: var(--accent); }
}

/* ───── اجزا ───── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > * { min-width: 0; max-width: 100%; }
.row > select.input, .row > input.input { width: auto; flex: 1 1 140px; }
a.stat-value { text-decoration: none; color: inherit; }
.spacer { flex: 1; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-label { color: var(--text-2); font-size: .85rem; }
.stat-value { font-size: 1.45rem; font-weight: 700; overflow-wrap: anywhere; line-height: 1.5; }
@media (max-width: 480px) { .stat { padding: 12px; } .stat-value { font-size: 1.1rem; } }
.stat-sub { font-size: .8rem; color: var(--text-3); }
.stat.accent { border-color: rgba(229, 57, 53, .5); }
.pos { color: var(--success); }
.neg { color: var(--error); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 500; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--error); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.btn.icon { padding: 0; width: 40px; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: .78rem; color: var(--text-3); }
.field .err { font-size: .8rem; color: var(--error); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s; outline: none;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--accent); }
.input.invalid { border-color: var(--error); }
.input.num { text-align: left; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: .88rem; user-select: none;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--accent-soft); color: #ff6b67; }
.badge.info { background: var(--info-soft); color: var(--info); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-2); font-weight: 500; font-size: .82rem; background: var(--surface-2); position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table td.wrap { white-space: normal; min-width: 180px; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .ic { width: 42px; height: 42px; color: var(--text-3); margin-bottom: 8px; }
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: #ff8a86; border: 1px solid rgba(229, 57, 53, .35); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* پلاک ایرانی */
.plate {
  display: inline-flex; align-items: stretch; direction: ltr; border: 2px solid #111; border-radius: 6px; overflow: hidden; background: #fff; color: #111;
  font-weight: 700; font-size: .95rem; line-height: 1; height: 30px; flex: none;
}
.plate .flag { width: 14px; background: linear-gradient(#239f40 33%, #fff 33% 66%, #da0000 66%); }
.plate .main { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.plate .region { display: flex; flex-direction: column; align-items: center; justify-content: center; border-inline-start: 2px solid #111; padding: 0 6px; font-size: .8rem; }
.plate .region small { font-size: .5rem; font-weight: 500; }
.plate-input { display: flex; direction: ltr; gap: 6px; align-items: center; }
.plate-input .input { text-align: center; padding: 8px 4px; }
.plate-input .p1 { width: 56px; } .plate-input .p2 { width: 70px; } .plate-input .rg { width: 56px; } .plate-input select { width: 76px; }

/* انتخابگر خودرو */
.picker { position: relative; }
.picker-results {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 340px; overflow-y: auto;
}
.picker-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:last-child { border-bottom: 0; }
.picker-item[aria-selected="true"], .picker-item:hover { background: var(--surface-3); }
.picker-item .grow { flex: 1; min-width: 0; }
.picker-item .name { font-weight: 500; }
.picker-item .meta { font-size: .78rem; color: var(--text-2); }
.picker-selected { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }

/* وضعیت سرویس */
.svc { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; grid-column: 1 / -1; }
.progress > i { display: block; height: 100%; background: var(--success); border-radius: 6px; }
.progress.warning > i { background: var(--warning); }
.progress.danger > i { background: var(--accent); }

/* بازدید سلامت */
.insp-group { margin-top: 18px; }
.insp-group h3 { font-size: .9rem; color: var(--text-2); margin-bottom: 6px; }
.insp-item { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 8px 12px; padding: 12px 8px; border-bottom: 1px solid var(--border); align-items: center; border-radius: var(--radius-sm); }
.insp-item.incomplete { background: rgba(229, 57, 53, .08); box-shadow: inset 3px 0 0 var(--accent); }
.insp-title { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.insp-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.item-problems { grid-column: 1 / -1; color: #ff8a86; font-size: .82rem; }
.item-problems:empty { display: none; }
.ticks { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; font-size: .86rem; user-select: none; }
.tick input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.tick:has(input:checked) { border-color: var(--info); background: var(--info-soft); color: var(--text); }
.tick.fabric:has(input:checked) { border-color: var(--success); background: var(--success-soft); }
.insp-item .extra { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.insp-item .extra > * { flex: 1 1 140px; min-width: 0; }
.insp-item .extra .note { flex: 3 1 220px; }
.insp-item .extra .input { min-height: 38px; }
@media (max-width: 640px) {
  .insp-item { grid-template-columns: 1fr; gap: 6px; padding: 10px 6px; }
  .insp-controls { align-items: stretch; gap: 6px; }
  .ticks .tick { flex: 1; justify-content: center; padding: 6px 4px; }
  .seg { display: grid; grid-template-columns: repeat(4, 1fr); }
  .seg button { padding: 6px 2px; font-size: .76rem; }
  .list-item { flex-wrap: wrap; }
  .list-item .grow { flex-basis: 60%; }
}
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--bg); padding: 6px 10px; cursor: pointer; font-size: .82rem; color: var(--text-2); border-inline-start: 1px solid var(--border); }
.seg button:first-child { border-inline-start: 0; }
.seg button[aria-pressed="true"].ok { background: var(--success-soft); color: var(--success); }
.seg button[aria-pressed="true"].watch { background: var(--warning-soft); color: var(--warning); }
.seg button[aria-pressed="true"].replace { background: var(--accent-soft); color: #ff6b67; }
.seg button[aria-pressed="true"].replaced { background: var(--info-soft); color: var(--info); }
.seg button[aria-pressed="true"].na { background: var(--surface-3); color: var(--text); }

/* نمودار ستونی ساده */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 180px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-pair { display: flex; gap: 2px; align-items: flex-end; height: 140px; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 16px; border-radius: 4px 4px 0 0; background: var(--surface-3); min-height: 2px; }
.bar.rev { background: #6E7A8A; }
.bar.net { background: var(--success); }
.bar.net.loss { background: var(--accent); }
.bar-label { font-size: .68rem; color: var(--text-3); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: middle; }

/* مودال و پیام */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: min(620px, 100%); max-height: calc(100vh - 32px);
  overflow-y: auto; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 640px) { .modal-back { place-items: end stretch; padding: 0; } .modal { width: 100%; border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; } }
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
@media (max-width: 860px) { .toasts { bottom: 84px; inset-inline: 16px; max-width: none; } }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); animation: up .2s ease; }
.toast.success { border-color: rgba(39, 174, 96, .5); }
.toast.error { border-color: rgba(229, 57, 53, .6); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* صفحات ورود */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 85% -10%, rgba(229, 57, 53, .18), transparent 60%), var(--bg); }
.auth-card { width: min(460px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.hero { max-width: 1080px; margin: 0 auto; padding: 32px 20px 60px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.35; margin: 18px 0 12px; }
.hero .lead { color: var(--text-2); font-size: 1.05rem; max-width: 640px; }
.feature { padding: 18px; }
.feature h3 { margin: 8px 0 4px; }
.feature .ic { width: 26px; height: 26px; color: var(--accent); }

/* چاپ فاکتور و کارنامه */
.doc { background: #fff; color: #111; border-radius: var(--radius); padding: 28px; font-size: 14px; overflow-x: auto; }
@media (max-width: 640px) {
  .doc { padding: 14px; font-size: 12.5px; } .doc th, .doc td { padding: 5px 6px; }
  .doc table.items tr.hrow { display: none; }
  .doc table.items tr.item { display: grid; grid-template-columns: 1fr auto auto; border: 1px solid #cfd4da; border-top: 0; }
  .doc table.items tr.item td { border: 0; }
  .doc table.items tr.item td.x { grid-column: 1 / -1; padding-top: 0; color: #444; }
  .doc table.items tr.item td.x.empty { display: none; }
}
.doc .mlabel { display: none; }
@media (max-width: 640px) { .doc .mlabel { display: inline; color: #777; } }
.doc .muted { color: #555; }
.doc h1 { font-size: 1.25rem; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc th, .doc td { border: 1px solid #cfd4da; padding: 7px 9px; text-align: start; vertical-align: top; }
.doc th { background: #f1f3f5; font-weight: 500; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px solid #E53935; padding-bottom: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.doc .group-title { background: #fbe9e9; font-weight: 700; }
.doc .totals { width: min(340px, 100%); margin-inline-start: auto; margin-top: 12px; }
.doc .totals td:first-child { color: #555; }
.doc .res { font-weight: 700; white-space: nowrap; }
.doc .res.ok { color: #1e8449; } .doc .res.watch { color: #b7791f; } .doc .res.replace { color: #c62828; } .doc .res.replaced { color: #1d5fbf; } .doc .res.na { color: #777; }
.doc .cond { font-weight: 700; white-space: nowrap; } .doc .cond.fabric { color: #1e8449; } .doc .cond.repaired { color: #b7791f; } .doc .cond.replaced { color: #1d5fbf; }
.doc .stamp { margin-top: 18px; padding: 12px; border: 2px dashed #1d5fbf; border-radius: 10px; color: #1d5fbf; }
.doc .void { margin: 12px 0; padding: 12px; border: 2px solid #c62828; color: #c62828; font-weight: 700; text-align: center; border-radius: 10px; }
.doc .plate { border-color: #111; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bottom-nav, .no-print, .toasts { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .doc { border-radius: 0; padding: 0; }
  @page { size: A4; margin: 12mm; }
}

.map-frame { width: 100%; height: 260px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font-size: .8rem; white-space: pre; margin: 0; }
.sms-preview { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-size: .9rem; line-height: 1.9; max-height: 50vh; overflow-y: auto; }
.arrival { border-color: rgba(91, 155, 240, .5); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.contact-grid a { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; min-width: 0; }
.contact-grid a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .bank { margin-top: 14px; padding: 10px 12px; border: 1px solid #cfd4da; border-radius: 10px; }
.doc .contacts { margin-top: 10px; color: #555; font-size: .9em; }

.print-only { display: none; }
@media print { .print-only { display: block; } .stat { border: 1px solid #ccc; color: #000; background: #fff; } .list-item, .card { color: #000; background: #fff; border-color: #ccc; } }
.brief .issues { border-color: rgba(229, 57, 53, .45); }
.profile { max-width: 760px; margin: 0 auto; }
.nav-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
@media (max-width: 640px) {
  .seg { display: grid; grid-template-columns: repeat(4, 1fr); }
  .seg button { padding: 7px 2px; font-size: .74rem; line-height: 1.5; }
  .insp-item .extra { grid-template-columns: none; }
}

/* ───── شبکه، صدا، آفلاین، اشتراک، نقشه ───── */
.stack-sm > * + * { margin-top: 8px; }
.row.wrap { flex-wrap: wrap; }
.linkish { background: none; border: 0; padding: 0; text-align: start; cursor: pointer; color: var(--text); }
.linkish:hover b { color: var(--accent-hover); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }

/* نشان آفلاین و صف ارسال */
.net-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(91, 155, 240, .35); background: var(--info-soft); color: var(--info); border-radius: 999px; padding: 3px 12px; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.net-pill .ic { width: 16px; height: 16px; }
.net-pill.warn { background: var(--warning-soft); color: var(--warning); border-color: rgba(242, 184, 75, .4); }
.topbar .net-pill { margin-inline-start: auto; }
.banner .ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ثبت با صدا */
.btn.mic { align-self: flex-start; margin-top: 6px; }
.btn.mic.listening { background: var(--accent); border-color: var(--accent); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, .55); } 50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); } }
@media (prefers-reduced-motion: reduce) { .btn.mic.listening { animation: none; } }
.field > .btn.mic { width: max-content; }
.voice-card { border-color: rgba(229, 57, 53, .35); background: linear-gradient(180deg, rgba(229, 57, 53, .06), transparent 60%), var(--surface); }
.voice-card textarea { min-height: 84px; }
.insp-item.voice-hit { outline: 2px solid var(--info); outline-offset: 2px; transition: outline-color .3s; }

/* اشتراک در پیام‌رسان‌ها */
.share-bar { display: flex; flex-wrap: wrap; gap: 8px; }

/* سوابق شبکه */
.network-card h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.network-card label.list-item { cursor: pointer; }
.list-item.referral { align-items: flex-start; }
.ref-targets { max-height: 280px; overflow-y: auto; }
.ref-targets label.list-item { cursor: pointer; }

/* نقشه تعمیرگاه‌ها */
.wide-page { max-width: 1400px; margin-inline: auto; }
.public-head h1 { font-size: 1.25rem; }
.dir-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dir-map-wrap { position: sticky; top: 12px; }
.shop-map { height: min(70vh, 640px); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.shop-map.map-failed::after { content: 'نقشه بارگذاری نشد؛ فهرست تعمیرگاه‌ها در کنار صفحه است.'; display: grid; place-items: center; height: 100%; color: var(--text-3); padding: 16px; text-align: center; }
.shop-list { display: flex; flex-direction: column; gap: 10px; }
.shop-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .3s; }
.shop-card.flash { border-color: var(--accent); }
.spec-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 1px 10px; }
.spec-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.spec-filter .chip small { color: var(--text-3); }
.c-suspension { background: #E53935; } .c-mechanic { background: #F2994A; } .c-electric { background: #F2C94C; } .c-oil { background: #27AE60; } .c-tire { background: #8E99A8; }
.c-body { background: #9B51E0; } .c-detailing { background: #2DB7C4; } .c-inspection { background: #5B9BF0; } .c-other { background: #B0B7C0; }
.c-paint_check { background: #EC4899; } .c-parts { background: #14B8A6; } .c-wholesale { background: #0E7490; }
.shop-pin { background: none; border: 0; }
.shop-pin span { display: block; width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); margin: 0 auto; }
.shop-pin.listing span { opacity: .75; border-style: dashed; }
.leaflet-container { direction: ltr; font-family: var(--font); background: var(--surface-2); }
.leaflet-popup-content { direction: rtl; text-align: right; font-family: var(--font); }
.leaflet-popup-content .pop { display: flex; flex-direction: column; gap: 4px; color: #1b2027; }
.leaflet-popup-content a { color: #c62828; }
@media (max-width: 860px) {
  .dir-grid { grid-template-columns: 1fr; }
  .dir-map-wrap { position: static; }
  .shop-map { height: 52vh; }
}

/* ───── اپ مالک خودرو ───── */
.owner-app { max-width: 760px; margin-inline: auto; padding: 16px 16px 96px; }
.owner-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 16px; }
.owner-top h1 { font-size: 1.15rem; }
.owner-hero { text-align: center; padding: 28px 8px 8px; }
.owner-hero .brand-mark { margin: 0 auto 12px; width: 56px; height: 56px; }
.owner-hero h1 { font-size: 1.4rem; margin-bottom: 6px; }
.owner-points { display: grid; gap: 10px; margin: 18px 0; }
.owner-points div { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: .92rem; }
.owner-points .ic { color: var(--accent); margin-top: 3px; }
.veh-card { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.veh-card .grow { min-width: 0; }
.veh-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; inset-inline-start: 8px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border); margin-top: 3px; }
.tl-item.part .tl-dot { background: var(--success-soft); border-color: var(--success); }
.tl-item.report .tl-dot { background: var(--info-soft); border-color: var(--info); }
.tl-item.own .tl-dot { background: var(--warning-soft); border-color: var(--warning); }
.tl-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.tl-meta { color: var(--text-3); font-size: .8rem; }
.share-toggle { display: flex; gap: 12px; align-items: flex-start; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; border: 1px solid var(--border); transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--success-soft); border-color: var(--success); }
.switch input:checked + span::after { background: var(--success); transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.owner-nav { position: fixed; bottom: 0; inset-inline: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
.owner-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem; color: var(--text-3); text-decoration: none; padding: 4px 12px; border-radius: 10px; }
.owner-nav a.active { color: var(--accent); }
.owner-nav .ic { width: 22px; height: 22px; }
.svc-due { display: flex; align-items: center; gap: 8px; }

/* ───── گواهی تشخیص رنگ و کارشناسی ───── */
.car-map { width: 100%; max-width: 260px; height: auto; display: block; margin-inline: auto; }
.car-map .car-label { font-size: 11px; fill: var(--text-3); font-family: var(--font); }
.car-map .car-wheel { fill: var(--text-3); opacity: .6; }
.car-map .car-glass { fill: var(--info-soft); stroke: var(--border); stroke-width: 1; }
.car-panel { stroke: var(--text-2); stroke-width: 1.2; transition: fill .15s; }
.car-panel[role="button"] { cursor: pointer; }
.car-panel[role="button"]:hover, .car-panel:focus-visible { stroke: var(--text); stroke-width: 2.4; outline: none; }
.pt-none { fill: transparent; stroke-dasharray: 3 3; }
.pt-original { fill: #3a434f; }
.pt-spot { fill: #F2B84B; }
.pt-painted { fill: #F08A24; }
.pt-putty { fill: #E5483B; }
.pt-replaced { fill: #8E6CEF; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); vertical-align: middle; }
.sw.pt-original { background: #3a434f; } .sw.pt-spot { background: #F2B84B; } .sw.pt-painted { background: #F08A24; } .sw.pt-putty { background: #E5483B; } .sw.pt-replaced { background: #8E6CEF; }
.paint-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; font-size: .8rem; color: var(--text-2); margin-top: 8px; }
.paint-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chip.brush { gap: 6px; }
.chip.brush.active { outline: 2px solid var(--text); outline-offset: 1px; }
.cert-editor { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 16px; align-items: start; margin-top: 12px; }
.cert-editor > * { min-width: 0; }
.cert-map { position: sticky; top: 76px; }
.panel-list { display: grid; gap: 6px; }
.panel-row { display: grid; grid-template-columns: 120px minmax(120px, 1fr) 110px minmax(120px, 1.4fr); gap: 6px; align-items: center; padding: 6px; border-radius: var(--radius-sm); }
.panel-row > div.small { grid-column: 1 / -1; }
.panel-row:empty { display: none; }
.panel-row.incomplete, .cert-row.incomplete { background: rgba(229, 57, 53, .08); box-shadow: inset 3px 0 0 var(--accent); }
.cert-check h2 { margin-bottom: 4px; }
.cert-row { display: grid; grid-template-columns: minmax(130px, 1fr) auto minmax(160px, 1.3fr); gap: 6px 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); border-radius: var(--radius-sm); }
.cert-row:last-child { border-bottom: 0; }
.cert-row .item-problems { grid-column: 1 / -1; }
.cseg .mk { font-weight: 700; margin-inline-end: 4px; }
@media (max-width: 760px) {
  .cert-editor { grid-template-columns: 1fr; }
  .cert-map { position: static; }
  .panel-row { grid-template-columns: 1fr 1fr; }
  .panel-row > b { grid-column: 1 / -1; }
  .panel-row > input:last-of-type { grid-column: 1 / -1; }
  .cert-row { grid-template-columns: 1fr; }
  .cseg .lb { display: none; }
  .cseg button { min-width: 44px; }
}
/* سند گواهی (سفید، مناسب چاپ) */
.doc .pt-none { fill: #fff; stroke: #9aa3ad; }
.doc .pt-original, .doc .sw.pt-original { fill: #e7ebef; background: #e7ebef; }
.doc .car-panel { stroke: #4b5563; }
.doc .car-map .car-label { fill: #6b7280; }
.doc .car-map .car-glass { fill: #dbe8f8; stroke: #9aa3ad; }
.doc .car-map .car-wheel { fill: #374151; }
.doc .paint-legend { color: #374151; }
.doc .cert-h { font-size: 15px; margin: 16px 0 8px; }
.doc .cert-verdict { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid #cfd4da; border-radius: 8px; background: #f7f9fb; margin: 12px 0; }
.doc .cert-paint { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.doc .cert-paint > * { min-width: 0; }
.doc .cert-paint .cert-map { position: static; }
.doc .cert-paint tr.hl td { background: #fff6e9; }
.doc .pchip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; color: #111; }
.doc .pchip.pt-original { background: #e7ebef; } .doc .pchip.pt-spot { background: #F8D88F; } .doc .pchip.pt-painted { background: #F6B572; }
.doc .pchip.pt-putty { background: #F19A92; } .doc .pchip.pt-replaced { background: #C4B3F7; }
.doc .cert-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.doc .cert-sec { border: 1px solid #cfd4da; border-radius: 8px; padding: 8px 10px; break-inside: avoid; }
.doc .cert-sec h3 { margin: 0 0 6px; font-size: 13.5px; color: #b42318; }
.doc .cert-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.doc .cert-sec li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.doc .cert-sec li small { flex-basis: 100%; color: #b42318; padding-inline-start: 26px; }
.doc .cmark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; border: 1px solid #cfd4da; font-weight: 700; font-size: 12px; }
.doc .cmark.ok { color: #157f3d; border-color: #9fd9b4; background: #effaf3; }
.doc .cmark.watch { color: #9a6700; border-color: #f2d48a; background: #fff8e6; }
.doc .cmark.replace { color: #b42318; border-color: #f4b2ab; background: #fdf0ee; }
.doc .cmark.na { color: #9aa3ad; }
@media (max-width: 640px) {
  .doc .cert-paint, .doc .cert-sections { grid-template-columns: 1fr; }
  .doc .cert-paint .car-map { max-width: 220px; }
}
@media print {
  .doc .cert-sections { grid-template-columns: repeat(2, 1fr); }
}

/* ───── انبار، درخواست قطعه، قیمت بازار ───── */
.text-danger { color: var(--error); } .text-success { color: var(--success); }
.nav a { position: relative; }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.bottom-nav a { position: relative; }
.bottom-nav .nav-badge { position: absolute; top: 2px; inset-inline-end: 18%; margin: 0; min-width: 18px; height: 18px; font-size: .7rem; }
.preq { display: grid; gap: 8px; }
.preq-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.preq-head > .grow { min-width: 0; flex: 1 1 220px; }
.preq-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; color: var(--text-2); }
.quote-list { display: grid; gap: 6px; }
.quote { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.quote.best { border-color: var(--success); }
.quote.accepted { border-color: var(--info); background: var(--info-soft); }
.quote.rejected, .quote.withdrawn { opacity: .55; }
.quote .price { font-size: 1.1rem; font-weight: 700; }
.quote .qmeta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; color: var(--text-2); }
.instock { background: var(--success-soft); color: var(--success); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; }
.market-row { display: grid; grid-template-columns: minmax(160px, 1.5fr) repeat(3, minmax(110px, 1fr)); gap: 8px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.market-row > * { min-width: 0; }
.market-row .mstat b { display: block; font-size: 1rem; }
.market-row .mstat span { font-size: .78rem; color: var(--text-3); }
@media (max-width: 720px) { .market-row { grid-template-columns: 1fr 1fr; } .market-row > :first-child { grid-column: 1 / -1; } }
.sale-lines { display: grid; gap: 8px; }
.sale-line { display: grid; grid-template-columns: minmax(160px, 2fr) 90px minmax(120px, 1fr) minmax(110px, 1fr) auto; gap: 8px 12px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.sale-line > * { min-width: 0; }
.sale-line .field b { display: block; padding: 8px 0; }
@media (max-width: 640px) { .sale-line { grid-template-columns: 90px 1fr; } .sale-line > .grow { grid-column: 1 / -1; } }
/* جست‌وجوی قطعه و مقایسه قیمت */
.input.big { font-size: 1.05rem; min-height: 50px; }
.ps-filters > * { flex: 1 1 140px; min-width: 0; }
.ps-filters > .btn { flex: 0 1 auto; }
.part-group { display: grid; gap: 10px; }
.part-head { display: flex; gap: 10px; align-items: flex-start; }
.part-head h3 { margin: 0 0 2px; font-size: 1.05rem; }
.part-range { font-size: .95rem; }
.part-range b { color: var(--success); font-size: 1.1rem; }
.offers { display: grid; gap: 6px; }
.offer { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main price" "actions actions"; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.offer:first-child:not(.out) { border-color: var(--success); }
.offer.out { opacity: .6; }
.offer-main { grid-area: main; min-width: 0; display: grid; gap: 4px; }
.offer-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.offer-price { grid-area: price; font-size: 1.15rem; font-weight: 700; white-space: nowrap; align-self: center; }
.offer-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; }
.ps-car { border-top: 1px solid var(--border); padding-top: 10px; }

/* ───── Blazor ───── */
#blazor-error-ui { display: none; position: fixed; bottom: 12px; inset-inline: 12px; z-index: 1000; }
#blazor-error-ui .reload { font-weight: 700; }
.components-reconnect-show #blazor-error-ui, #blazor-error-ui[style*="block"] { display: block; }
tr.clickable { cursor: pointer; }
.full { grid-column: 1 / -1; }
