:root {
  --bg: #ffffff;
  --ink: #15171c;
  --muted: #6b7280;
  --soft: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e6e9ef;
  --line-strong: #d5dae3;
  --red: #e5232f;
  --red-dark: #c61622;
  --green: #16a06f;
  --shadow: 0 20px 55px rgba(22, 30, 46, 0.12);
  --radius: 8px;
  --font: "Inter", ui-sans-serif, system-ui, sans-serif;
  --arabic-font: "Tajawal", "Inter", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
}

html[dir="rtl"] body {
  font-family: var(--arabic-font);
}

body.menu-open {
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 74px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand,
.primary-nav,
.header-actions,
.service-tabs,
.search-mode,
.section-heading,
.sort-control,
.service-actions,
.dashboard-header,
.period-switch,
.panel-header,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 1.28rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
}

.primary-nav {
  justify-content: center;
  gap: 34px;
  font-size: 0.94rem;
  font-weight: 750;
}

.primary-nav a {
  padding: 27px 0;
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.hero-location {
  color: var(--red);
}

.header-actions {
  justify-content: flex-end;
  gap: 10px;
}

.locale-link,
.ghost-button,
.primary-button,
.find-button,
.panel-header button,
.service-actions button,
.detail-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.locale-link,
.ghost-button,
.primary-button,
.find-button,
.panel-header button,
.service-actions button,
.detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.primary-button,
.find-button,
.detail-button {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.primary-button:hover,
.find-button:hover,
.detail-button:hover {
  background: var(--red-dark);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.market-shell,
.listings-section,
.services-band,
.dashboard,
.site-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding-right: 24px;
  padding-left: 24px;
}

.market-shell {
  padding-top: 28px;
}

.service-tabs {
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.service-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #3d424e;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.tab.is-active,
.search-mode button.is-selected,
.period-switch button.is-active {
  border-color: rgba(229, 35, 47, 0.22);
  color: var(--red);
  background: #fff2f3;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: 28px;
  min-height: 570px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 56px 0 40px;
}

.hero-location {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 0.92rem;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 580px;
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.search-card {
  width: min(100%, 660px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.search-mode {
  gap: 8px;
  margin-bottom: 14px;
}

.search-mode button,
.period-switch button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--soft);
  font-size: 0.84rem;
  font-weight: 850;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: #4a4f5b;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-size: 0.94rem;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font-size: 0.94rem;
  font-weight: 700;
}

html[dir="rtl"] select {
  padding: 0 12px 0 36px;
}

.find-button {
  align-self: end;
  min-width: 118px;
  min-height: 46px;
}

.hero-media,
.car-photo {
  position: relative;
  overflow: hidden;
  background: var(--soft);
}

.hero-media {
  min-height: 520px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.hero-media img,
.car-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-media.image-failed,
.car-photo.image-failed {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(229, 35, 47, 0.12), rgba(36, 116, 232, 0.08)), var(--soft);
}

.hero-media.image-failed::after,
.car-photo.image-failed::after {
  content: attr(data-fallback);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-media.image-failed img,
.car-photo.image-failed img {
  display: none;
}

.deal-strip {
  position: absolute;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(15, 18, 24, 0.72);
  backdrop-filter: blur(14px);
}

.deal-strip span {
  color: #ffb9bd;
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.deal-strip strong {
  font-size: 1.25rem;
}

.deal-strip small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-weight: 750;
}

.listings-section {
  padding-top: 58px;
}

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  line-height: 1.15;
}

.section-heading p,
.dashboard-header p,
.services-band p,
.site-footer span {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.sort-control {
  gap: 10px;
  min-width: 220px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

.sort-control select {
  border: 0;
  min-height: 42px;
  padding-inline-start: 0;
}

.listing-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.favorite-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  font-weight: 850;
}

.favorite-filter.is-active,
.favorite-filter:hover {
  border-color: rgba(229, 35, 47, 0.25);
  color: var(--red);
  background: #fff2f3;
}

.favorite-filter b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 0.75rem;
}

.market-toast {
  position: sticky;
  top: 78px;
  z-index: 8;
  width: min(100%, 620px);
  margin: 0 0 16px;
  padding: 13px 16px;
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: var(--radius);
  color: #14532d;
  background: #ecfdf5;
  box-shadow: 0 14px 30px rgba(20, 83, 45, 0.08);
  font-weight: 850;
}

.market-toast[hidden] {
  display: none;
}

.car-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.car-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.car-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 16px 38px rgba(22, 30, 46, 0.1);
}

.car-photo {
  aspect-ratio: 16 / 10;
}

.car-tag {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 0.73rem;
  font-weight: 850;
}

.car-tag.is-reserved {
  background: #111827;
}

.reserved-note {
  margin: -4px 0 0;
  color: #9f1239;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.5;
}

.car-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.car-title-row,
.price-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.car-title-row h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.favorite-button {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
}

.favorite-button.is-saved {
  border-color: rgba(229, 35, 47, 0.2);
  color: var(--red);
  background: #fff2f3;
}

.car-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.car-meta span {
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--soft);
}

.price-row {
  align-items: center;
}

.price-row strong {
  font-size: 1.14rem;
}

.price-row small {
  color: var(--muted);
  font-weight: 750;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.card-actions button:first-child {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.card-actions button:disabled,
.action-form button:disabled {
  cursor: not-allowed;
  border-color: var(--line-strong);
  color: var(--muted);
  background: var(--soft);
}

.services-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-top: 56px;
  padding-top: 26px;
  padding-bottom: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-api-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1240px;
  margin: 28px auto 0;
  padding: 18px 24px 44px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

.admin-api-note i {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: #fff2f3;
}

.admin-api-note .ghost-button {
  flex: 0 0 auto;
  margin-inline-start: auto;
  white-space: nowrap;
}

.notice,
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 750;
  line-height: 1.5;
}

.notice {
  color: #08724f;
  background: #e8f8f2;
}

.alert {
  color: #9f1239;
  background: #fff1f2;
}

.account-nav {
  justify-content: flex-end;
}

.account-shell {
  display: grid;
  gap: 22px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 42px 24px 64px;
}

.account-summary,
.account-card,
.account-empty,
.account-favorite-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
}

.account-summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
  font-weight: 850;
}

.account-summary h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.account-summary p,
.account-card p,
.account-empty p,
.account-favorite-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.account-card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 22px;
}

.account-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.account-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.account-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.account-card .primary-button {
  width: 100%;
}

.account-section {
  display: grid;
  gap: 18px;
}

.account-favorites {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-favorite-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.account-favorite-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.account-favorite-card div {
  display: grid;
  gap: 6px;
  align-content: center;
  min-width: 0;
  padding: 14px 14px 14px 0;
}

html[dir="rtl"] .account-favorite-card div {
  padding: 14px 0 14px 14px;
}

.account-favorite-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.account-favorite-card strong {
  color: var(--red);
}

.account-empty {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 34px 20px;
  text-align: center;
}

.account-empty i {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: #fff2f3;
  font-size: 1.25rem;
}

.detail-dialog {
  width: min(1120px, calc(100% - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 34px 90px rgba(15, 18, 24, 0.25);
}

.detail-dialog::backdrop {
  background: rgba(15, 18, 24, 0.52);
}

.dialog-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 18, 24, 0.58);
}

.detail-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  min-height: 620px;
}

.detail-media {
  min-height: 620px;
  background: var(--soft);
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-content {
  display: grid;
  align-content: start;
  gap: 18px;
  overflow-y: auto;
  padding: 34px;
}

.detail-content .hero-location {
  margin: 0;
}

.detail-content h2 {
  margin-bottom: 0;
}

#detailDescription {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-price {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.detail-price strong {
  font-size: 1.35rem;
}

.detail-price span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.detail-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-lists section,
.action-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.detail-lists h3,
.action-form h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.detail-lists dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.detail-lists div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-lists dt {
  font-weight: 800;
}

.detail-lists dd {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
  text-align: end;
}

.detail-lists ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-inline-start: 20px;
  color: var(--muted);
  font-weight: 700;
}

.action-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-form {
  display: grid;
  gap: 12px;
  align-content: start;
  background: var(--surface-2);
}

.action-form p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.action-form .primary-button {
  width: 100%;
}

.form-output {
  min-height: 20px;
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.45;
}

.detail-dialog {
  width: min(1180px, calc(100% - 28px));
  max-height: min(920px, calc(100vh - 28px));
  overflow: auto;
  background: #f7f9fb;
}

.detail-profile {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px;
}

.profile-gallery,
.profile-summary,
.profile-card,
.highlight-grid article,
.action-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.profile-gallery {
  overflow: hidden;
}

.profile-gallery .detail-media {
  min-height: 0;
  aspect-ratio: 16 / 9;
  background: #eef2f6;
}

.profile-gallery .detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.gallery-thumbs button {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--soft);
}

.gallery-thumbs button.is-active {
  border-color: var(--red);
}

.gallery-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-summary {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.profile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-badge-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 850;
}

.profile-badge-row span:last-child {
  color: #155e75;
  background: #e0f2fe;
}

.profile-summary h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.profile-meta,
.profile-location {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.7;
}

.profile-location {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-location i {
  color: var(--red);
}

.profile-summary .detail-price {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.profile-summary .detail-price > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.profile-summary .detail-price strong {
  font-size: 1.35rem;
}

.profile-summary .detail-price span,
.profile-summary .detail-price small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.6;
}

.profile-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-main {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.highlight-grid article {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.highlight-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.highlight-grid strong {
  font-size: 1.02rem;
}

.profile-card {
  padding: 18px;
}

.profile-card h3 {
  margin: 0 0 12px;
  font-size: 1.08rem;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.profile-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.profile-card-head i {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  color: #08724f;
  background: #e8f8f2;
}

.service-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  padding-top: 58px;
  padding-bottom: 44px;
}

.dashboard-rail {
  position: sticky;
  top: 98px;
  align-self: start;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 850;
}

.rail-item.is-active,
.rail-item:hover {
  color: var(--red);
  background: #fff2f3;
}

.dashboard-main {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.dashboard-header {
  justify-content: space-between;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.inventory-panel,
.orders-panel,
.chart-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card i {
  color: var(--red);
}

.metric-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.65rem;
  line-height: 1;
}

.metric-card small {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.8fr);
  grid-template-areas:
    "inventory orders"
    "inventory chart";
  gap: 18px;
}

.inventory-panel {
  grid-area: inventory;
}

.orders-panel {
  grid-area: orders;
}

.chart-panel {
  grid-area: chart;
}

.panel-header {
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 1rem;
}

.panel-header button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.inventory-table {
  display: grid;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(110px, 0.8fr) minmax(90px, 0.55fr) minmax(90px, 0.55fr);
  min-width: 610px;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row span {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #303642;
  font-size: 0.9rem;
  font-weight: 750;
}

.table-head {
  background: var(--surface-2);
}

.table-head span {
  min-height: 46px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
  font-style: normal;
}

.status.live {
  color: #08724f;
  background: #e8f8f2;
}

.status.pending {
  color: #8b5d05;
  background: #fff5d9;
}

.status.sold {
  color: #205eb8;
  background: #eaf2ff;
}

.order-list {
  display: grid;
}

.order-list article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

html[dir="rtl"] .order-list article {
  grid-template-columns: 1fr 42px;
}

.order-list article:last-child {
  border-bottom: 0;
}

.order-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: #fff2f3;
}

html[dir="rtl"] .order-icon {
  order: 2;
}

.order-list strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.order-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  height: 190px;
  padding: 18px 16px;
}

.bar-chart span {
  display: block;
  min-height: 18px;
  height: var(--value);
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
}

.site-footer {
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  border-top: 1px solid var(--line);
}

.site-footer strong {
  color: var(--red);
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: auto auto;
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
    justify-self: end;
  }

  .primary-nav,
  .header-actions {
    position: fixed;
    right: 18px;
    left: 18px;
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
  }

  .primary-nav {
    top: 84px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .account-nav {
    position: static;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 12px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .account-nav a {
    padding: 0;
  }

  .primary-nav a {
    padding: 14px 12px;
  }

  .header-actions {
    top: 279px;
    justify-content: stretch;
    padding: 8px;
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .menu-open .primary-nav,
  .menu-open .header-actions {
    display: flex;
  }

  .header-actions .ghost-button,
  .header-actions .primary-button,
  .header-actions .locale-link {
    flex: 1;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding-top: 38px;
  }

  .hero-media {
    min-height: 390px;
  }

  .field-grid,
  .car-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .find-button {
    grid-column: 1 / -1;
  }

  .services-band,
  .admin-api-note,
  .account-grid,
  .account-favorites,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .dashboard-rail {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rail-item {
    justify-content: center;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "inventory"
      "orders"
      "chart";
  }

  .detail-profile {
    grid-template-columns: 1fr;
  }

  .profile-summary {
    position: static;
  }

  .highlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 66px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .market-shell,
  .listings-section,
  .services-band,
  .admin-api-note,
  .dashboard,
  .site-footer {
    max-width: 100%;
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero-panel {
    padding-top: 28px;
  }

  h1 {
    font-size: 3rem;
  }

  html[dir="rtl"] h1 {
    font-size: 2.75rem;
    line-height: 1.08;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .search-card {
    padding: 12px;
  }

  .field-grid,
  .car-grid,
  .metric-grid,
  .dashboard-rail {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .account-summary,
  .dashboard-header,
  .services-band,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .listing-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .favorite-filter {
    justify-content: center;
    width: 100%;
  }

  .sort-control {
    width: 100%;
  }

  .account-shell {
    padding: 28px 16px 48px;
  }

  .account-summary {
    padding: 18px;
  }

  .account-favorite-card {
    grid-template-columns: 1fr;
  }

  .account-favorite-card img {
    height: 190px;
  }

  .account-favorite-card div,
  html[dir="rtl"] .account-favorite-card div {
    padding: 0 14px 14px;
  }

  .service-actions {
    justify-content: stretch;
  }

  .service-actions button {
    flex: 1 1 140px;
  }

  .admin-api-note {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-api-note .ghost-button {
    width: 100%;
    margin-inline-start: 0;
  }

  .hero-media {
    min-height: 300px;
  }

  .detail-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .detail-shell,
  .detail-profile,
  .detail-lists,
  .highlight-grid,
  .action-forms {
    grid-template-columns: 1fr;
  }

  .detail-profile {
    padding: 10px;
  }

  .detail-media {
    min-height: 240px;
  }

  .gallery-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-quick-actions {
    grid-template-columns: 1fr;
  }

  .detail-content {
    padding: 22px;
  }

  .deal-strip {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
}
