:root {
  --navy: #0a2342;
  --navy-2: #12335f;
  --navy-3: #1b4a85;
  --gold: #c8a24a;
  --gold-2: #e8cd86;
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1b2433;
  --muted: #637086;
  --line: #d9dfe9;
  --danger: #c0392b;
  --ok: #1f8a5b;
  --warn: #b7791f;
  --radius: 12px;
  --shadow: 0 6px 22px rgba(10, 35, 66, 0.1);
  --font: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy-3); }

/* ---------------- الأزرار ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 600;
  transition: transform .08s, box-shadow .15s, background .15s; text-decoration: none; color: inherit;
}
.btn:hover { box-shadow: 0 3px 10px rgba(10, 35, 66, .12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: linear-gradient(180deg, var(--navy-3), var(--navy-2)); color: #fff; border-color: var(--navy-2); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #3b2c06; border-color: #b58f35; }
.btn-danger { background: var(--danger); color: #fff; border-color: #a52f23; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.btn svg { flex: none; }

/* ---------------- شاشة الدخول ---------------- */
.login-root {
  position: fixed; inset: 0; overflow: auto;
  background:
    radial-gradient(1100px 600px at 50% 8%, #1d4f8f 0%, rgba(29, 79, 143, 0) 60%),
    radial-gradient(900px 500px at 85% 100%, rgba(200, 162, 74, .22) 0%, rgba(200, 162, 74, 0) 60%),
    linear-gradient(160deg, #061630 0%, #0a2342 55%, #0d2c52 100%);
  color: #fff;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-stage {
  position: relative; z-index: 1; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 16px 14px; gap: 6px;
}
.login-brand { display: flex; align-items: center; gap: 14px; animation: fadeDown .8s ease both; }
.login-emblem { width: 88px; height: 88px; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45)); animation: float 5s ease-in-out infinite; }
.login-ministry { display: flex; flex-direction: column; line-height: 1.25; }
.login-country { color: var(--gold-2); font-size: 15px; letter-spacing: .5px; }
.login-ministry strong { font-size: 30px; font-weight: 800; background: linear-gradient(180deg, #fff, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-map-wrap { width: min(94vw, 560px); height: clamp(250px, 44vh, 470px); animation: fadeUp 1s .1s ease both; }
.login-map-wrap canvas { display: block; }
.login-title { margin: 0; font-size: clamp(20px, 3.4vw, 28px); font-weight: 700; text-align: center; color: #f4f7ff; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.login-action { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; width: 100%; }
.login-btn {
  border: 0; border-radius: 999px; padding: 14px 54px; font-size: 20px; font-weight: 800; color: #3b2c06;
  background: linear-gradient(180deg, #f4dc98, #c8a24a); box-shadow: 0 10px 28px rgba(200, 162, 74, .38), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .15s, box-shadow .2s; animation: pulseGlow 2.8s ease-in-out infinite;
}
.login-btn:hover { transform: translateY(-2px) scale(1.02); }
.login-btn:disabled { opacity: .7; }
.login-btn.small { padding: 11px 38px; font-size: 18px; animation: none; }
.login-card {
  width: min(92vw, 380px); background: rgba(255, 255, 255, .08); border: 1px solid rgba(232, 205, 134, .35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 18px; padding: 18px 20px 16px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.login-card.enter { animation: slideUp .45s ease both; }
.login-card.shake { animation: shake .4s; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; color: #eaf0ff; }
.login-card input {
  height: 46px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .28); background: rgba(5, 18, 40, .55); color: #fff;
  padding: 0 14px; width: 100%; outline: none; font-size: 17px;
}
.login-card input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(232, 205, 134, .25); }
.pw-wrap { position: relative; display: block; }
.pw-eye { position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; font-size: 18px; padding: 6px; opacity: .8; color: #fff; }
.pw-wrap input { padding-inline-start: 44px; }
.login-error { min-height: 22px; color: #ffb3a8; font-size: 14px; font-weight: 600; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-link { background: transparent; border: 0; color: var(--gold-2); text-decoration: underline; font-size: 15px; }
.login-foot { margin-top: 6px; font-size: 13px; color: rgba(255, 255, 255, .55); text-align: center; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 10px 28px rgba(200, 162, 74, .35), inset 0 1px 0 rgba(255, 255, 255, .6); } 50% { box-shadow: 0 10px 38px rgba(232, 205, 134, .65), inset 0 1px 0 rgba(255, 255, 255, .6); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@media (max-height: 700px) { .login-map-wrap { height: clamp(200px, 36vh, 360px); } .login-emblem { width: 66px; height: 66px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------- الهيكل العام ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; color: #fff;
  background: linear-gradient(180deg, var(--navy-2), var(--navy)); border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; margin-inline-end: auto; text-decoration: none; color: #fff; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand b { font-size: 18px; display: block; line-height: 1.2; }
.brand small { color: var(--gold-2); font-size: 12px; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .22); min-height: 40px; }
.nav .btn:hover { background: rgba(255, 255, 255, .2); }
.nav .btn.active { background: var(--gold); color: #3b2c06; border-color: var(--gold-2); }
.nav .btn-settings { padding-inline: 12px; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 14px; }
.userchip i { font-style: normal; background: var(--gold); color: #3b2c06; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.page { max-width: 1320px; margin: 0 auto; padding: 18px 16px 40px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e3e8f0; }
.page-title { margin: 0 0 14px; font-size: 22px; color: var(--navy); }

/* ---------------- نموذج السند ---------------- */
.form-title { text-align: center; margin: 4px 0 14px; font-size: 24px; color: var(--navy); }
.form-title::after { content: ""; display: block; width: 90px; height: 3px; margin: 6px auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.search-card { padding: 14px 16px; margin-bottom: 16px; }
.search-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.search-tab { border: 1px solid var(--line); background: #f5f7fb; border-radius: 999px; padding: 6px 16px; font-weight: 600; font-size: 14px; }
.search-tab.active { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.search-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.search-row .fld { flex: 1 1 150px; }
.search-row .fld.grow { flex: 3 1 260px; }
.search-go { display: flex; align-items: center; gap: 8px; }
.search-go svg { width: 20px; height: 20px; }
.results { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 700; color: var(--navy); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { background: #eaf0f8; color: var(--navy); text-align: right; font-weight: 700; padding: 9px 12px; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-top: 1px solid #edf0f5; vertical-align: top; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f6f9fe; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-note { text-align: center; color: var(--muted); padding: 16px; }

.deed-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.deed-form { padding: 18px 18px 14px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c12 { grid-column: span 12; } .c2 { grid-column: span 2; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .fld > .lbl { font-weight: 700; font-size: 14px; color: var(--navy); }
.fld > label .req { color: var(--danger); margin-inline-start: 3px; }
.inp, .fld input:not([type=checkbox]):not([type=file]), .fld select, .fld textarea {
  width: 100%; min-height: 42px; border: 1px solid #c5cddb; border-radius: 9px; padding: 8px 12px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.fld textarea { min-height: 96px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 162, 74, .25); }
.fld input:disabled, .fld select:disabled, .fld textarea:disabled { background: #f3f5f9; color: #2a3446; -webkit-text-fill-color: #2a3446; border-color: #dfe4ed; opacity: 1; }
.fld.invalid input, .fld.invalid select { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.pair { display: grid; grid-template-columns: 1.7fr 1fr; gap: 8px; }
.area-group { border: 1px solid #c5cddb; border-radius: 10px; padding: 8px 10px 10px; position: relative; }
.area-group > .lbl { font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 6px; display: block; }
.area-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.area-grid .fld > label { font-weight: 600; font-size: 13px; color: var(--muted); }
.ltr { direction: ltr; text-align: right; }
.fld input.ltr { text-align: right; }

.combo { position: relative; }
.combo input { padding-inline-end: 38px !important; }
.combo-btn { position: absolute; inset-inline-end: 0; top: 0; height: 100%; width: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; }
.combo-btn:hover { color: var(--navy); }
.fld input:disabled ~ .combo-btn { display: none; }
.combo-list { position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 3px); max-height: 230px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid #c5cddb; border-radius: 10px; box-shadow: 0 12px 28px rgba(10, 35, 66, .18); }
.combo-list li { padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.combo-list li:hover { background: #eef3fb; }
.combo-list li.empty { color: var(--muted); cursor: default; font-size: 14px; }
.combo-list li.empty:hover { background: transparent; }

.preview-card { padding: 12px; position: sticky; top: 84px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.preview-head b { color: var(--navy); }
.x-close { width: 36px; height: 36px; border-radius: 8px; border: 0; background: #d92d20; color: #fff; font-size: 20px; font-weight: 800; line-height: 1; }
.x-close:hover { background: #b42318; }
.preview-box { border: 2px dashed #b7c1d3; border-radius: 10px; background: #f8fafd; min-height: 380px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.preview-box img { max-width: 100%; max-height: 520px; display: block; cursor: zoom-in; }
.preview-empty { color: var(--muted); text-align: center; padding: 20px; }
.preview-empty svg { width: 64px; height: 64px; opacity: .45; display: block; margin: 0 auto 8px; }
.preview-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.preview-actions .wide { grid-column: span 2; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.act-row .btn { flex: 1 1 auto; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.view { background: #e3f1ea; color: var(--ok); }
.badge.edit { background: #fff1d6; color: var(--warn); }
.badge.new { background: #e3ecfa; color: var(--navy-3); }
.mode-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.mode-line .code { font-family: ui-monospace, Consolas, monospace; background: #f0f3f9; padding: 1px 8px; border-radius: 6px; color: var(--navy); }

/* ---------------- الإعدادات والتقارير ---------------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 18px; font-weight: 700; color: var(--navy); }
.tab.active { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.panel { padding: 18px; }
.panel h3 { margin: 0 0 6px; color: var(--navy); }
.panel p.hint { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.users-table input[type=text], .users-table input[type=password] { width: 100%; min-width: 120px; min-height: 38px; border: 1px solid #c5cddb; border-radius: 8px; padding: 6px 10px; }
.users-table td { vertical-align: middle; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.chk input { width: 18px; height: 18px; accent-color: var(--navy-2); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.admin { background: var(--gold); color: #3b2c06; }
.pill.warn { background: #fff1d6; color: var(--warn); }
.logo-preview { width: 150px; height: 150px; border: 1px dashed #b7c1d3; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: #f4f7fb; }
.logo-preview img { max-width: 130px; max-height: 130px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.kiosk-code { font-family: ui-monospace, Consolas, monospace; font-size: 38px; letter-spacing: 6px; font-weight: 800; color: var(--navy); background: #fff8e1; border: 2px dashed var(--gold); border-radius: 12px; padding: 10px 22px; direction: ltr; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eaf0f8; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; }
.chip button { border: 0; background: #cfd9ea; width: 22px; height: 22px; border-radius: 50%; line-height: 1; font-weight: 800; color: var(--navy); }
.chip button:hover { background: var(--danger); color: #fff; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 12px 14px; border-radius: 12px; background: linear-gradient(180deg, #f6f9fe, #edf2fa); border: 1px solid #dfe7f3; }
.stat b { display: block; font-size: 26px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters .fld { flex: 1 1 140px; }
.act-tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e8edf5; color: var(--navy); white-space: nowrap; }
.act-tag.add { background: #dff3e8; color: var(--ok); } .act-tag.edit, .act-tag.user_edit { background: #fff1d6; color: var(--warn); }
.act-tag.delete, .act-tag.login_fail { background: #fde4e1; color: var(--danger); }
.diff { margin: 4px 0 0; padding: 0; list-style: none; font-size: 14px; }
.diff li { margin: 2px 0; } .diff del { color: var(--danger); } .diff ins { color: var(--ok); text-decoration: none; font-weight: 700; }
details.snap summary { cursor: pointer; color: var(--navy-3); }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 12px; }
.url-list { display: flex; flex-direction: column; gap: 8px; }
.url-item { display: flex; align-items: center; gap: 10px; background: #f4f7fb; border-radius: 10px; padding: 8px 12px; flex-wrap: wrap; }
.url-item code { direction: ltr; font-size: 16px; font-weight: 700; color: var(--navy); }

/* ---------------- نوافذ ورسائل ---------------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(6, 22, 48, .55); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; width: min(94vw, 460px); padding: 20px 22px 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); max-height: 92vh; overflow: auto; animation: slideUp .25s ease both; }
.modal.wide { width: min(96vw, 760px); }
.modal h3 { margin: 0 0 10px; color: var(--navy); }
.modal-text { margin: 0 0 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; flex-wrap: wrap; }
#toast-root { position: fixed; z-index: 200; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--ok); color: #fff; padding: 11px 20px; border-radius: 12px; font-weight: 700; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; text-align: center; width: 100%; }
.toast.err { background: var(--danger); } .toast.info { background: var(--navy-2); }
.toast.hide { opacity: 0; transform: translateY(-10px); }
.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .9); display: flex; flex-direction: column; }
.lightbox-scroll { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 56px 12px 12px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 80px); cursor: zoom-in; background: #fff; }
.lightbox-close { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; font-size: 20px; font-weight: 800; }
.lightbox-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #cbd5e6; font-size: 13px; pointer-events: none; }

/* ---------------- الطباعة (ملصق الباركود) ---------------- */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff; }
  #print-area { display: block !important; }
  @page { margin: 8mm; }
  .label { width: 86mm; border: 1.5px solid #000; padding: 4mm; text-align: center; font-family: var(--font); color: #000; page-break-inside: avoid; }
  .label .l-head { font-weight: 800; font-size: 11pt; border-bottom: 1px solid #000; padding-bottom: 2mm; margin-bottom: 2mm; }
  .label svg { width: 34mm; height: 34mm; display: inline-block; }
  .label .l-code { font-family: Consolas, monospace; letter-spacing: 2px; font-size: 11pt; font-weight: 700; }
  .label .l-row { font-size: 10pt; margin-top: 1.5mm; }
  .label .l-owner { font-size: 12pt; font-weight: 800; margin-top: 1.5mm; }
  .report-print-hide { display: none !important; }
}

/* ---------------- الجوال ---------------- */
@media (max-width: 980px) {
  .deed-layout { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .preview-box { min-height: 260px; }
}
@media (max-width: 700px) {
  .topbar { padding: 8px 10px; }
  .brand b { font-size: 15px; } .brand small { display: none; }
  .nav .btn { padding: 6px 10px; font-size: 14px; min-height: 38px; }
  .nav .btn .lbl-txt { display: none; }
  .nav .btn.keep-txt .lbl-txt { display: inline; }
  .userchip span { display: none; }
  .page { padding: 12px 10px 30px; }
  .c2, .c3, .c4, .c5, .c6 { grid-column: span 6; }
  .c12 { grid-column: span 12; }
  .area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-title { font-size: 20px; }
  .tbl th, .tbl td { padding: 8px 8px; font-size: 14px; }
}
@media (max-width: 460px) {
  .c2, .c3, .c4, .c5, .c6 { grid-column: span 12; }
  .pair { grid-template-columns: 1fr 1fr; }
}

/* طباعة تقرير العمليات */
@media print {
  .rp h2 { margin: 0 0 4px; } .rp p { margin: 0 0 8px; color: #333; font-size: 10pt; }
  .rp-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .rp-table th, .rp-table td { border: 1px solid #888; padding: 3px 5px; text-align: right; vertical-align: top; }
  .rp-table th { background: #eee; }
  .rp-table ul { margin: 0; padding: 0; list-style: none; }
}

/* ===== شاشة الدخول (نسخة الجسيمات) ===== */
.login-bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.login-root { transition: opacity .6s ease; }
.login-root.leaving { opacity: 0; }
.login-stage { padding-top: 14px; gap: 4px; }
.login-hello { text-align: center; margin-top: 2px; }
.hello-kicker { display: block; color: var(--gold-2); letter-spacing: 2px; font-size: clamp(14px, 2vw, 17px); animation: fadeDown .9s .5s ease both; }
.hello-title { margin: 2px 0 0; font-size: clamp(26px, 5.2vw, 52px); font-weight: 800; line-height: 1.25; }
.hello-title span {
  display: inline-block; opacity: 0; animation: wordIn .8s ease forwards, shimmer 6s 2.2s linear infinite;
  background: linear-gradient(100deg, #ffffff 0%, #bfe6ff 30%, #ffe9a8 50%, #bfe6ff 70%, #ffffff 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@keyframes wordIn { from { opacity: 0; transform: translateY(18px) scale(.96); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes shimmer { to { background-position: -250% 0; } }
.login-map-wrap { position: relative; width: min(94vw, 760px); height: clamp(260px, 44vh, 520px); flex: none; animation: none; }
.login-map-wrap .br { position: absolute; width: 26px; height: 26px; border: 0 solid rgba(232, 205, 134, .55); opacity: .8; }
.br.tl { top: 0; inset-inline-start: 0; border-top-width: 2px; border-inline-start-width: 2px; }
.br.tr { top: 0; inset-inline-end: 0; border-top-width: 2px; border-inline-end-width: 2px; }
.br.bl { bottom: 0; inset-inline-start: 0; border-bottom-width: 2px; border-inline-start-width: 2px; }
.br.bb { bottom: 0; inset-inline-end: 0; border-bottom-width: 2px; border-inline-end-width: 2px; }
.login-status { display: inline-flex; align-items: center; gap: 9px; padding: 5px 16px; border: 1px solid rgba(120, 200, 255, .32); border-radius: 999px; font-size: 14px; color: #c9ecff; background: rgba(8, 28, 58, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.login-status i { width: 8px; height: 8px; border-radius: 50%; background: #5cf2b0; box-shadow: 0 0 10px #5cf2b0; animation: blink 1.4s ease-in-out infinite; }
.login-status span { transition: opacity .22s, transform .22s; display: inline-block; }
.login-status span.swap { opacity: 0; transform: translateY(5px); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.login-action { min-height: 140px; padding-top: 12px; }
.login-title { display: none; }
@media (max-height: 760px) { .login-map-wrap { height: clamp(210px, 36vh, 400px); } .login-emblem { width: 60px; height: 60px; } }
@media (max-width: 560px) { .login-map-wrap { height: clamp(230px, 38vh, 380px); } .login-ministry strong { font-size: 24px; } }

/* قيود النظام القديم */
.deed-extra { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.issue-banner { border: 1px solid #e0b73a; background: #fff8e1; color: #5b4300; border-radius: 10px; padding: 10px 14px; }
.issue-banner ul { margin: 6px 0 0; padding-inline-start: 20px; }
.legacy-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #f8fafd; }
.legacy-box summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.legacy-tbl th { width: 38%; background: transparent; font-weight: 600; color: var(--muted); }
.legacy-tbl td { direction: ltr; text-align: right; word-break: break-all; }

/* ===== ترحيب الوزارة (ثلاثة أسطر) ===== */
.login-brand { gap: 16px; }
.login-emblem { width: 96px; height: 96px; }
.login-ministry { gap: 2px; align-items: flex-start; }
.login-ministry .m1 { font-size: clamp(28px, 4.2vw, 40px); font-weight: 800; line-height: 1.15; background: linear-gradient(180deg, #fff, #ffe9a8); -webkit-background-clip: text; background-clip: text; color: transparent; animation: fadeDown .8s .15s ease both; }
.login-ministry .m2 { font-size: clamp(17px, 2.4vw, 22px); font-weight: 700; color: #e8f1ff; letter-spacing: .3px; animation: fadeDown .8s .3s ease both; }
.login-ministry .m3 { font-size: clamp(13px, 1.9vw, 17px); font-weight: 600; color: var(--gold-2); padding-top: 4px; margin-top: 2px; border-top: 1px solid rgba(232, 205, 134, .45); animation: fadeDown .8s .45s ease both; }
@media (max-width: 560px) { .login-emblem { width: 70px; height: 70px; } .login-brand { gap: 10px; } .login-ministry .m3 { font-size: 12.5px; } }

/* ===== سجل النظام القديم ===== */
.op-tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: #e8edf5; color: var(--navy); }
.op-tag.op-insert { background: #dff3e8; color: var(--ok); }
.op-tag.op-update { background: #fff1d6; color: #9a6a00; }
.op-tag.op-delete { background: #fde4e1; color: var(--danger); }
.op-tag.op-search { background: #eef1f6; color: var(--muted); }
.pill-gone { display: inline-block; font-size: 12px; font-weight: 700; color: var(--danger); background: #fdecea; border: 1px solid #f5c6c0; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.log-tbl td.note-cell { max-width: 260px; color: #44506a; font-size: 13px; white-space: pre-line; }
.log-tbl td.muted, .muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
td.pre { white-space: pre-line; }
.legacy-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #fff8e6; border: 1px solid #f0dca8; color: #5d4a12; font-size: 14px; }
.legacy-hint b { color: #3b2c06; }
.count-pill { display: inline-block; min-width: 22px; text-align: center; background: var(--navy); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; margin-inline-start: 6px; }
.hist-box .hist-wrap { margin-top: 8px; }
.img-src-note { position: absolute; inset-inline-start: 10px; bottom: 10px; background: rgba(15, 33, 64, .78); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; pointer-events: none; }
.preview-box { position: relative; }
.ll-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ll-summary .stat { cursor: pointer; text-align: start; font: inherit; }
.ll-summary .stat.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 162, 74, .2); }
.ll-summary .stat.gone b { color: var(--danger); }
.path-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.test-out { margin-top: 12px; font-size: 14px; }
.test-out code { direction: ltr; unicode-bidi: embed; font-size: 12px; }
.fld label small.muted { font-weight: 500; }
.stamp small { color: var(--muted); font-size: 12px; }

/* ---------- الواجهة الرئيسية الموحدة ---------- */
.portal { max-width: 980px; padding-top: 34px; }
.pt-hello h1 { margin: 0; font-size: 26px; color: var(--navy); }
.pt-hello p { margin: 6px 0 22px; color: var(--muted, #5b6577); }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.pt-card {
  position: relative; display: flex; align-items: center; gap: 16px; text-align: right; width: 100%;
  padding: 26px 22px; border-radius: 20px; background: var(--card, #fff); border: 1px solid #e3e8f0; color: inherit; text-decoration: none;
  font: inherit; cursor: pointer; overflow: hidden; box-shadow: 0 14px 34px -18px rgba(10, 35, 66, .45); transition: transform .15s, box-shadow .15s;
}
.pt-card::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 6px; background: var(--accent); }
.pt-card:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -18px rgba(10, 35, 66, .55); }
.pt-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pt-card:disabled { opacity: .6; cursor: wait; }
.pt-ico { flex: none; width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; background: var(--tint); color: var(--accent); }
.pt-ico svg { width: 34px; height: 34px; }
.pt-txt { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pt-txt b { font-size: 20px; color: var(--navy); }
.pt-txt small { color: #5b6577; font-size: 14px; line-height: 1.6; }
.pt-go { width: 24px; height: 24px; color: var(--navy-3); flex: none; }
.pt-msg { color: var(--danger, #b8392b); min-height: 1.4em; margin: 16px 0 0; font-weight: 600; }
.pt-note { color: #5b6577; font-size: 14px; margin: 6px 0 0; }
@media (max-width: 520px) { .portal { padding-top: 20px; } .pt-card { padding: 20px 16px; } .pt-hello h1 { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .pt-card { transition: none; } }
.pn-wrap { display: flex; gap: 6px; align-items: stretch; }
.pn-wrap input { flex: 1; min-width: 0; }
.pn-key { flex: none; min-width: 44px; border-radius: 10px; border: 1px solid #cdd5e1; background: #f3f6fa; color: var(--navy); font: 700 20px/1 "JetBrains Mono", monospace; cursor: pointer; }
.pn-key:active { background: var(--gold-2); }

/* ================= الخرائط ================= */
.pt-maps .pt-ico { position: relative; }
.pt-pin { position: absolute; top: -10px; left: -6px; font-style: normal; font-size: 18px; animation: mpBob 2.4s ease-in-out infinite; }
.mp-page { max-width: 1280px; margin: 0 auto; padding: 18px 16px 48px; }
.mp-hero { position: relative; overflow: hidden; border-radius: 18px; color: #fff; padding: 34px 28px 30px;
  background: radial-gradient(120% 140% at 85% 0%, #2f6b45 0%, #1d4a3a 40%, var(--navy) 100%); box-shadow: 0 18px 40px -22px rgba(10,35,66,.7);
  animation: mpRise .6s cubic-bezier(.2,.8,.2,1) both; }
.mp-contours { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .22; }
.mp-contours path { fill: none; stroke: #e8cd86; stroke-width: 1.4; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: mpDraw 3.2s ease forwards; }
.mp-contours path:nth-child(2) { animation-delay: .3s; } .mp-contours path:nth-child(3) { animation-delay: .6s; } .mp-contours path:nth-child(4) { animation-delay: .9s; }
.mp-hero-in { position: relative; max-width: 720px; }
.mp-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 5px 14px 5px 10px; font-size: 13px; }
.mp-compass { display: inline-block; font-size: 18px; animation: mpSpin 7s ease-in-out infinite; }
.mp-hero h1 { margin: 12px 0 6px; font-size: 32px; }
.mp-wave { display: inline-block; animation: mpWave 3s ease-in-out infinite; transform-origin: 50% 80%; }
.mp-hero p { margin: 0 0 18px; color: #d6e4dc; }
.mp-search { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 6px 6px 6px 6px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); }
.mp-search .mp-pin { font-size: 22px; padding: 0 6px; animation: mpBob 2.4s ease-in-out infinite; }
.mp-search input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 18px; padding: 10px 4px; background: transparent; color: var(--text); font-family: var(--font); }
.mp-search .btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; }
.mp-search .btn svg { width: 18px; height: 18px; }
.mp-results { margin-top: 18px; background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); animation: mpRise .4s ease both; }
.mp-results h2 { margin: 0 0 12px; font-size: 18px; }
.mp-res-list { display: grid; gap: 10px; }
.mp-res { display: flex; align-items: center; gap: 14px; width: 100%; text-align: right; background: #f6f9f5; border: 1px solid #d7e6d2; border-radius: 12px; padding: 8px; cursor: pointer; font-family: var(--font); color: var(--text);
  animation: mpRise .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d); transition: transform .2s, box-shadow .2s; }
.mp-res:hover { transform: translateX(-4px); box-shadow: 0 10px 22px -14px rgba(31,74,58,.6); }
.mp-res img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; background: #eee; flex: none; }
.mp-res span { flex: 1; display: flex; flex-direction: column; gap: 3px; } .mp-res small { color: var(--muted); }
.mp-res > svg { width: 20px; height: 20px; transform: scaleX(-1); color: #3f7d3a; flex: none; }
.mp-none { display: flex; gap: 12px; align-items: flex-start; } .mp-none > span { font-size: 30px; animation: mpBob 2s ease-in-out infinite; }
.mp-none div { display: flex; flex-direction: column; gap: 4px; } .mp-none small { color: var(--muted); }
.mp-searching { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.mp-radar { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #3f7d3a; position: relative; }
.mp-radar::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #3f7d3a; animation: mpPing 1.2s ease-out infinite; }
.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.mp-head h2 { margin: 0; font-size: 20px; } .mp-head small { color: var(--muted); font-weight: 400; }
.mp-filter { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-family: var(--font); min-width: 220px; background: #fff; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.mp-card { display: flex; flex-direction: column; text-align: right; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; cursor: pointer; font-family: var(--font); color: var(--text);
  box-shadow: 0 4px 14px -8px rgba(10,35,66,.3); animation: mpRise .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d); transition: transform .25s, box-shadow .25s; }
.mp-card:hover, .mp-card:focus-visible { transform: translateY(-4px); box-shadow: 0 18px 34px -16px rgba(10,35,66,.5); outline: none; }
.mp-card:focus-visible { box-shadow: 0 0 0 3px #3f7d3a; }
.mp-thumb { position: relative; display: block; aspect-ratio: 4 / 3; background: #f1f1ec; overflow: hidden; }
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.mp-card:hover .mp-thumb img { transform: scale(1.08); }
.mp-drop { position: absolute; top: 8px; left: 10px; font-size: 22px; opacity: 0; transform: translateY(-18px); transition: opacity .25s, transform .35s cubic-bezier(.3,1.6,.5,1); filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); }
.mp-card:hover .mp-drop { opacity: 1; transform: none; }
.mp-cap { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
.mp-cap b { font-size: 15px; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mp-chips i { font-style: normal; font-size: 12px; background: #eef5ec; color: #2c5d28; border-radius: 6px; padding: 2px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-chips i.dim { background: #f1f2f5; color: var(--muted); }
/* العارض */
body.mp-open { overflow: hidden; }
.mp-viewer { position: fixed; inset: 0; z-index: 90; background: #10202e; display: flex; flex-direction: column; opacity: 0; transform: scale(.97); transition: opacity .35s ease, transform .35s cubic-bezier(.2,.8,.2,1); }
.mp-viewer.in { opacity: 1; transform: none; }
.mp-vbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: linear-gradient(90deg, var(--navy), #1d4a3a); color: #fff; flex-wrap: wrap; }
.mp-vtitle { flex: 1; min-width: 160px; display: flex; flex-direction: column; } .mp-vtitle small { color: #c9d8d0; font-size: 12px; }
.mp-vtools { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-ib { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-family: var(--font); font-size: 14px; transition: background .2s, transform .15s; }
.mp-ib svg { width: 20px; height: 20px; } .mp-ib:hover { background: rgba(255,255,255,.18); } .mp-ib:active { transform: scale(.94); }
.mp-ib[data-a="close"] svg { transform: none; }
.mp-ib.gold { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; } .mp-ib.gold:hover { background: var(--gold-2); }
.mp-ib.on { background: #e05a47; border-color: #e05a47; }
.mp-osd { flex: 1; position: relative; background: #e9e7df; }
.mp-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); z-index: 2; }
.mp-loading span { font-size: 46px; animation: mpBob 1.6s ease-in-out infinite; }
.mp-hint { position: absolute; bottom: 16px; right: 16px; left: 16px; max-width: 560px; margin: 0 auto; background: rgba(224,90,71,.95); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; text-align: center; animation: mpRise .3s ease both; }
.mp-marker { cursor: pointer; }
.mp-mk { position: relative; display: flex; flex-direction: column; align-items: center; animation: mpDropIn .55s cubic-bezier(.3,1.6,.5,1) both; }
.mp-mk-pin { display: block; width: 30px; height: 30px; color: #d63b2a; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); } .mp-mk-pin svg { display: block; width: 100%; height: 100%; }
.mp-mk-lbl { margin-bottom: 2px; background: #fff; color: #222; font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3); white-space: nowrap; }
.mp-marker.hot .mp-mk-pin { width: 44px; height: 44px; animation: mpBob 1.2s ease-in-out infinite; }
.mp-marker.hot .mp-mk-lbl { background: #d63b2a; color: #fff; font-size: 14px; }
.mp-marker.hot .mp-mk::after { content: ""; position: absolute; bottom: -5px; width: 30px; height: 10px; border-radius: 50%; background: rgba(214,59,42,.45); animation: mpPing 1.4s ease-out infinite; }
@keyframes mpRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mpDraw { to { stroke-dashoffset: 0; } }
@keyframes mpSpin { 0%, 100% { transform: rotate(-25deg); } 50% { transform: rotate(35deg); } }
@keyframes mpWave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg) translateY(-2px); } }
@keyframes mpBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes mpPing { from { transform: scale(.8); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes mpDropIn { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .mp-hero { padding: 24px 16px; } .mp-hero h1 { font-size: 26px; } .mp-ib span { display: none; } .mp-search .btn span { display: none; } .mp-filter { min-width: 0; width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .mp-page *, .mp-viewer, .mp-viewer *, .pt-pin { animation: none !important; transition: none !important; }
  .mp-contours path { stroke-dashoffset: 0; }
}
@media print {
  .map-print { font-family: var(--font); color: #000; }
  .mpp-head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1.5px solid #000; padding-bottom: 2mm; margin-bottom: 3mm; font-size: 10pt; }
  .map-print img { display: block; max-width: 100%; max-height: 255mm; margin: 0 auto; object-fit: contain; }
}
.mp-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 48px; opacity: .35; background: repeating-linear-gradient(45deg, #f3f3ee 0 12px, #ebebe4 12px 24px); }
.mp-noimg.sm { position: static; width: 96px; height: 64px; border-radius: 8px; font-size: 26px; flex: none; }
.mp-open-btn { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: #3f7d3a; color: #fff; font-weight: 700; font-size: 14px; transition: background .2s; }
.mp-card:hover .mp-open-btn { background: #2f6b45; }

/* نتائج البحث: تظليل رقم العقار + نوع المعاملة بجانبه */
.tbl .parcel-cell { white-space: nowrap; }
.tbl .parcel-hl { display: inline-block; padding: 2px 9px; border-radius: 7px; background: rgba(30, 110, 220, .14); box-shadow: inset 0 0 0 1px rgba(30, 110, 220, .22); font-weight: 700; direction: ltr; }
.tbl .tx-badge { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; vertical-align: middle; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .tx-own   { background: rgba(22, 163, 74, .15);  color: #15803d; box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .3); }
.tbl .tx-sale  { background: rgba(217, 119, 6, .15);  color: #b45309; box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .3); }
.tbl .tx-other { background: rgba(100, 116, 139, .14); color: #475569; box-shadow: inset 0 0 0 1px rgba(100, 116, 139, .28); }

/* ===================== الشاشة الرئيسية: المعالجة الذكية + خريطة الخالدية ===================== */
.pt-smart { position: relative; display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 18px; border-radius: 20px; text-decoration: none; color: #fff; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #24569a 0%, var(--navy-2) 45%, var(--navy) 100%); box-shadow: 0 18px 40px -18px rgba(10, 35, 66, .7); transition: transform .15s, box-shadow .15s; }
.pt-smart::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(232, 205, 134, .35), transparent 65%); pointer-events: none; }
.pt-smart:hover { transform: translateY(-2px); box-shadow: 0 24px 48px -18px rgba(10, 35, 66, .8); }
.pt-smart:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.pt-smart-ico { flex: none; width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); border: 1px solid rgba(232, 205, 134, .45); color: var(--gold-2); }
.pt-smart-ico svg { width: 36px; height: 36px; }
.pt-smart-txt { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pt-smart-txt b { font-size: 22px; }
.pt-smart-txt small { color: #c9d6ea; font-size: 14.5px; line-height: 1.6; }
.pt-smart-go { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--navy); font-weight: 800; position: relative; z-index: 1; }
.pt-smart-go svg { width: 20px; height: 20px; }
.pt-smart-go em { font-style: normal; }
.pt-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; margin-bottom: 18px; }
.pt-row:has(> :only-child) { grid-template-columns: 1fr; }
.pt-panel { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; min-width: 0; }
.pt-panel header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pt-panel h2 { margin: 0; font-size: 18px; color: var(--navy); }
.pt-panel header small { color: var(--muted); font-size: 13px; }
.k3d { position: relative; height: 340px; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #dfe8f3, #eef1f6); }
.k3d .maplibregl-ctrl-attrib { font-size: 10px; }
.k3d-msg { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }
.k3d-pin { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.k3d-pin span { background: var(--navy); color: #fff; font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--gold); box-shadow: 0 6px 14px rgba(10, 35, 66, .35); }
.k3d-pin::after { content: ""; width: 2px; height: 22px; background: var(--gold); }
.sm-empty { color: var(--muted); margin: 0; padding: 24px 8px; text-align: center; }
.sm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; }
.sm-item { width: 100%; display: flex; align-items: center; gap: 12px; text-align: start; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: #fbfcfe; }
.sm-item:hover:not(:disabled) { border-color: var(--navy-3); background: #f3f7fd; }
.sm-item:disabled { opacity: .65; cursor: default; }
.sm-thumb { flex: none; width: 52px; height: 52px; border-radius: 9px; overflow: hidden; background: var(--bg); }
.sm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sm-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--navy); }
.sm-info small { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.sm-info .parcel-hl, .pt-panel .parcel-hl { display: inline-block; padding: 0 7px; border-radius: 6px; background: rgba(30, 110, 220, .14); box-shadow: inset 0 0 0 1px rgba(30, 110, 220, .22); font-weight: 700; direction: ltr; }
.sm-st { flex: none; display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.sm-st em { font-style: normal; font-weight: 600; font-size: 11px; opacity: .85; font-family: "JetBrains Mono", monospace; }
.sm-st.ok { background: rgba(22, 163, 74, .14); color: #15803d; border-radius: 10px; }
.sm-st.wait { background: rgba(217, 119, 6, .15); color: #b45309; }
.sm-st.err { background: rgba(192, 57, 43, .12); color: var(--danger); }
@media (max-width: 860px) { .pt-row { grid-template-columns: 1fr; } .k3d { height: 300px; } }
@media (max-width: 520px) { .pt-smart { padding: 18px 16px; gap: 12px; flex-wrap: wrap; } .pt-smart-ico { width: 54px; height: 54px; } .pt-smart-txt b { font-size: 19px; } .pt-smart-go { width: 100%; justify-content: center; } }

/* صفحة المعالجة الذكية */
.smart { max-width: 760px; padding-top: 22px; }
.sm-back { display: inline-block; margin-bottom: 10px; color: var(--navy-3); text-decoration: none; font-weight: 600; }
.sm-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.sm-head h1 { margin: 0; font-size: 24px; color: var(--navy); }
.sm-head p { margin: 4px 0 0; color: var(--muted); }
.sm-badge { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--navy); color: var(--gold-2); }
.sm-badge svg { width: 26px; height: 26px; }
.sm-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: s; }
.sm-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card); color: var(--muted); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.sm-steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: 13px; }
.sm-steps li.now { color: var(--navy); outline: 2px solid var(--gold); }
.sm-steps li.now span { background: var(--gold); color: var(--navy); }
.sm-steps li.done span { background: var(--ok); color: #fff; }
.sm-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; }
.sm-frame { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 240px; border-radius: 14px; border: 2px dashed var(--navy-3); background: repeating-linear-gradient(135deg, #f6f8fc, #f6f8fc 12px, #eef2f9 12px, #eef2f9 24px); color: var(--navy-3); text-align: center; padding: 20px; }
.sm-frame svg { width: 72px; height: 72px; }
.sm-frame p { margin: 0; max-width: 380px; color: var(--muted); }
.sm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.sm-actions .btn { flex: 1; min-width: 160px; }
.btn-lg { padding: 14px 18px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.sm-msg, .sm-err { color: var(--danger); font-weight: 600; margin: 12px 0 0; }
.sm-reading { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sm-shot { position: relative; max-width: 100%; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 28px rgba(10, 35, 66, .25); }
.sm-shot img { display: block; max-width: 100%; max-height: 52vh; }
.sm-scanline { position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 18px 4px rgba(200, 162, 74, .6); animation: smScan 2.2s ease-in-out infinite alternate; }
@keyframes smScan { from { top: 0; } to { top: calc(100% - 3px); } }
.sm-status { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--navy); }
.sm-status small { color: var(--muted); }
.sm-spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: smSpin .9s linear infinite; }
@keyframes smSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sm-scanline, .sm-spin, .pt-smart { animation: none !important; transition: none !important; } }

/* حقول عبّأها الذكاء الاصطناعي */
.fld.ai-filled input, .fld.ai-filled select, .fld.ai-filled textarea { background: #f2f7ff; box-shadow: inset 0 0 0 1px rgba(30, 110, 220, .35); }
.fld.ai-unsure input, .fld.ai-unsure select, .fld.ai-unsure textarea { background: #fff6e8; box-shadow: inset 0 0 0 2px rgba(217, 119, 6, .55); }
.ai-note { display: block; width: 100%; margin-top: 4px; color: #b45309; font-size: 13.5px; }
