@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-400.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-500.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-700.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/fonts/Tajawal-900.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

:root {
  --charcoal: #17181A;
  --charcoal-2: #232426;
  --gold: #BD8E54;
  --gold-light: #D9B98A;
  --white: #FFFFFF;
  --taupe: #9C7854;
  --taupe-2: #7A6B68;
  --bg-light: #F3EEE7;
  --border: #E3DCD2;
  --red: #C0392B;
  --green: #3E7A4C;
  --amber: #B8860B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  direction: rtl;
  font-family: 'Tajawal', Arial, sans-serif;
  background: var(--bg-light);
  color: var(--charcoal);
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- Top nav ---------- */
.topnav {
  background: var(--charcoal);
  color: var(--white);
  border-bottom: 3px solid var(--gold);
}
.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  font-weight: 900;
  font-size: 18px;
}
.brand .bar { width: 4px; height: 22px; background: var(--gold); border-radius: 2px; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 500;
  color: #E9E4DC;
}
.nav-links a.active, .nav-links a:hover { background: var(--charcoal-2); color: var(--gold-light); }
.nav-logout {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-light);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.nav-logout:hover { background: var(--gold); color: var(--charcoal); }

.nav-search { display: flex; align-items: center; gap: 6px; margin: 10px 0; }
.nav-search input {
  background: var(--charcoal-2);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  width: 170px;
}
.nav-search input::placeholder { color: #9c9689; }
.nav-search input:focus { outline: none; border-color: var(--gold); }
.nav-search button {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-light);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.nav-search button:hover { background: var(--gold); color: var(--charcoal); }

main.page { padding: 28px 0 60px; }

/* ---------- Cards / sections ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 16px;
}
.section-title .bar { width: 4px; height: 20px; background: var(--gold); border-radius: 2px; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--charcoal);
  color: var(--white);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  background: var(--gold);
}
.stat-card .num { font-size: 30px; font-weight: 900; color: var(--gold-light); }
.stat-card .label { font-size: 14px; color: #cfc8bf; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--gold); color: var(--charcoal); }
.btn-primary:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border-color: var(--charcoal); color: var(--charcoal); }
.btn-outline:hover { background: var(--charcoal); color: var(--white); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-wa { background: #25D366; color: var(--white); }
.btn-wa:hover { background: #1ebe5a; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: var(--white);
  color: var(--charcoal);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(189,142,84,.18);
}
.field .err { color: var(--red); font-size: 13px; margin-top: 4px; }
.field input.invalid, .field select.invalid { border-color: var(--red); }
.field .hint { color: var(--taupe-2); font-size: 12px; margin-top: 4px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1 1 220px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
th { background: var(--charcoal); color: var(--gold-light); font-weight: 700; position: sticky; top: 0; }
th a { color: inherit; }
tr:hover td { background: #FAF7F2; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-red { background: #FCE7E4; color: var(--red); }
.badge-amber { background: #FCF1D8; color: var(--amber); }
.badge-green { background: #E2F0E4; color: var(--green); }
.badge-gray { background: #EDEAE4; color: var(--taupe-2); }

/* ---------- Filters bar ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.filters input, .filters select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}
.filters input[name="q"] { flex: 1 1 240px; }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 13px;
}
.pagination .current { background: var(--gold); border-color: var(--gold); color: var(--charcoal); font-weight: 700; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--charcoal) 0%, var(--charcoal-2) 100%);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 36px 30px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  border-top: 5px solid var(--gold);
}
.login-card .logo-mark { width: 6px; height: 30px; background: var(--gold); border-radius: 3px; margin: 0 auto 10px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--taupe-2); font-size: 14px; margin: 0 0 24px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; }

/* ---------- Misc ---------- */
.muted { color: var(--taupe-2); }
.gold { color: var(--gold); }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 700; }
.flash-success { background: #E2F0E4; color: var(--green); }
.flash-error { background: #FCE7E4; color: var(--red); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-grid .k { color: var(--taupe-2); font-size: 13px; }
.detail-grid .v { font-weight: 700; font-size: 15px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.log-item { border-right: 3px solid var(--gold); padding: 10px 14px; background: var(--bg-light); border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.log-item .date { font-weight: 700; font-size: 13px; }
.log-item .note { font-size: 14px; margin-top: 4px; }
textarea { resize: vertical; min-height: 90px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--taupe-2); }

/* ---- Customer consent (Jameel Plus CRM) ---- */
.consent-box { border: 1px dashed var(--gold, #BD8E54); border-radius: 10px; padding: 12px 14px; margin: 6px 0 16px; background: rgba(189,142,84,.06); }
.consent-check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.consent-check input { width: 18px; height: 18px; margin: 0; flex: none; }
.consent-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.consent-badge.yes { background: #e3f1e6; color: #1f6b35; }
.consent-badge.no { background: #fbeaea; color: #9b2c2c; }

/* ---- Jameel Plus monthly evidence report ---- */
.jp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.jp-month { display: flex; align-items: center; gap: 8px; }
.jp-month select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 14px; background: var(--white); }
.jp-howto ol { margin: 12px 0; padding-inline-start: 20px; line-height: 1.9; }
.jp-overall { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.jp-overall-num { font-size: 32px; font-weight: 900; color: var(--gold); line-height: 1.1; }
.jp-bar { height: 8px; background: #EDE6DB; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.jp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 99px; }
.jp-domain { margin-top: 30px; }
.jp-domain-title { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; margin-bottom: 12px; flex-wrap: wrap; }
.jp-domain-title .btn { margin-inline-start: auto; }
.jp-num { width: 30px; height: 30px; border-radius: 50%; background: var(--charcoal); color: var(--gold-light); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.jp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.jp-card { background: var(--white); border: 1px solid var(--border); border-top: 4px solid var(--gold); border-radius: 12px; padding: 18px 20px 14px; display: flex; flex-direction: column; }
.jp-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.jp-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #F6EEE3; color: var(--taupe); }
.jp-tag-ops { background: #E9EEF0; color: #3D5560; }
.jp-card-title { font-weight: 900; font-size: 17px; margin-top: 6px; }
.jp-card-meta { font-size: 12px; color: var(--taupe-2); text-align: left; line-height: 1.6; white-space: nowrap; }
.jp-label { display: block; font-size: 12px; color: var(--taupe-2); font-weight: 700; margin-bottom: 4px; }
.jp-ab { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; font-size: 14px; line-height: 1.7; }
.jp-a, .jp-b { border-radius: 10px; padding: 10px 12px; }
.jp-a { background: #F7F3EE; }
.jp-b { background: #FBF5EC; border: 1px solid #EAD8BF; }
.jp-arrow { align-self: center; color: var(--gold); font-size: 22px; font-weight: 900; }
.jp-meta-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; font-size: 14px; }
.jp-meta-row strong { display: block; }
.jp-steps, .jp-proc { margin: 4px 0 0; padding-inline-start: 20px; line-height: 1.9; font-size: 14px; }
.jp-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.jp-kpi { background: var(--charcoal); color: #E8E2D8; border-radius: 10px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.jp-kpi b { font-size: 22px; color: var(--gold-light); font-weight: 900; }
.jp-kpi span { font-size: 12px; line-height: 1.5; }
.jp-kpi small { color: #A99F93; }
.jp-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.jp-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.jp-table td:last-child { text-align: left; font-weight: 700; width: 90px; }
.jp-card-foot { margin-top: auto; padding-top: 12px; font-size: 11px; color: var(--taupe-2); border-top: 1px dashed var(--border); }
.jp-card > :nth-last-child(2) { margin-bottom: 14px; }
@media (max-width: 900px) {
  .jp-grid { grid-template-columns: 1fr; }
  .jp-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .jp-ab { grid-template-columns: 1fr; }
  .jp-arrow { transform: rotate(-90deg); justify-self: center; }
  .jp-meta-row { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topnav, .no-print { display: none !important; }
  body { background: #fff; }
  .jp-grid { grid-template-columns: 1fr; }
  .jp-card { break-inside: avoid; page-break-after: always; border-color: #ccc; }
  .jp-domain-title { break-after: avoid; }
  .jp-kpi, .jp-bar span, .jp-num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Privacy (evidence) mode: hides personal data for screenshots ---- */
.privacy-on .pii, .privacy-on a.pii-link { filter: blur(6px); }
.nav-privacy { background: transparent; border: 1px solid #5a5a5c; color: #cfc8bf; border-radius: 8px; padding: 5px 10px; font-family: inherit; font-size: 12px; cursor: pointer; }
.nav-privacy.on { background: var(--gold); color: var(--charcoal); border-color: var(--gold); }
.jp-card-main { border-top-width: 6px; }
.jp-main-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.jp-kpis-2 { grid-template-columns: repeat(2, 1fr); }
.jp-platforms th { text-align: right; font-size: 12px; color: var(--taupe-2); padding: 6px 8px; border-bottom: 2px solid var(--border); }
.jp-platforms td:not(:first-child) { text-align: center; font-weight: 700; width: auto; }
.jp-table + .jp-table { margin-top: 0; }
@media (max-width: 900px) { .jp-main-grid { grid-template-columns: 1fr; } }

/* ---- Public inquiry form (/ask/<showroom>) ---- */
.ask-page { background: var(--charcoal); min-height: 100vh; }
.ask-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.ask-card { background: var(--white); border-radius: 16px; border-top: 5px solid var(--gold); padding: 26px 22px; width: 100%; max-width: 440px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.ask-brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 16px; color: var(--taupe); margin-bottom: 14px; }
.ask-brand .bar { width: 4px; height: 20px; background: var(--gold); border-radius: 2px; }
.ask-card h1 { font-size: 21px; margin: 0 0 4px; line-height: 1.5; }
.ask-sub { color: var(--taupe-2); font-size: 13px; margin: 0 0 18px; }
.ask-card .field input, .ask-card .field textarea { font-size: 16px; }
.ask-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.7; background: #FBF5EC; border: 1px solid #EAD8BF; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.ask-consent input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.ask-consent.invalid { border-color: var(--red); }
.ask-submit { width: 100%; margin-top: 16px; padding: 12px; font-size: 16px; }
.ask-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ask-done { text-align: center; padding: 20px 0 8px; }
.ask-done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: var(--charcoal); font-size: 30px; font-weight: 900; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.ask-links { display: grid; gap: 10px; margin-top: 12px; }
.ask-link-row { display: grid; grid-template-columns: 90px 1fr auto auto; gap: 8px; align-items: center; }
.ask-link-row input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--bg-light); min-width: 0; }
@media (max-width: 600px) { .ask-link-row { grid-template-columns: 1fr auto auto; } .ask-link-row strong { grid-column: 1 / -1; } }

/* ---- Manually typed cars awaiting manager review (/cars) ---- */
.manual-cars { border-right: 4px solid var(--gold); }
.manual-car { border-top: 1px solid var(--border); padding: 12px 0; }
.manual-name { font-weight: 900; font-size: 15px; }
.manual-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.manual-row select, .manual-row input { flex: 1 1 160px; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 14px; background: var(--white); }
.manual-car details { margin-top: 8px; }
.manual-car summary { cursor: pointer; color: var(--taupe); font-size: 13px; font-weight: 700; }
