@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url("/assets/fonts/Tajawal_400Regular.ttf") format("truetype"); }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url("/assets/fonts/Tajawal_700Bold.ttf") format("truetype"); }
@font-face { font-family: "Tajawal"; font-weight: 900; font-display: swap; src: url("/assets/fonts/Tajawal_900Black.ttf") format("truetype"); }

:root {
  --navy-900: #0f1c30; --navy-800: #162844; --navy-700: #243b5e; --navy-600: #3b5478; --navy-500: #5a7194;
  --navy-300: #aab6c8; --navy-200: #d3dae5; --navy-100: #e6ebf2; --navy-50: #f3f5f9;
  --gold-500: #e9ac2c; --gold-400: #efc061; --gold-300: #f4d48f; --gold-100: #fbf0d5; --gold-50: #fdf8ea;
  --green: #0f7a4f; --green-bg: #e7f6ee; --red: #c0262d; --red-bg: #fdecee; --amber-bg: #fff6df;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 28, 48, .06), 0 8px 24px -12px rgba(15, 28, 48, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Tajawal", Tahoma, "Segoe UI", Arial, sans-serif; background: var(--navy-50); color: var(--navy-900); line-height: 1.7; font-size: 16px; }
h1, h2 { margin: 0 0 .4rem; line-height: 1.4; }
h1 { font-size: 1.5rem; font-weight: 900; }
h2 { font-size: 1.05rem; font-weight: 900; margin-bottom: .9rem; }
p { margin: 0 0 .8rem; }
a { color: #1d4fa8; text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .78rem; }
.muted { color: var(--navy-500); }
.small { font-size: .82rem; }
.strong { font-weight: 700; }
.block { display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.trap { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
[hidden] { display: none !important; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem; }

.card { background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.1rem; }
.card.slim { padding: .9rem 1rem; }
.card.success { border-color: #b9e3cf; padding: 2rem 1.25rem; }
.page-head { text-align: center; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 1.8rem; }
.sub { color: var(--navy-600); font-weight: 700; margin: 0; }
.head-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }

.note { display: flex; gap: .75rem; background: var(--gold-50); border: 1px solid var(--gold-300); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1.1rem; font-size: .92rem; }
.note p { margin: 0; }

.field { margin-bottom: .95rem; }
.field label, .upload-label, .filters label { display: block; font-weight: 700; font-size: .9rem; color: var(--navy-800); }
.req { color: var(--red); }
input, select, textarea { width: 100%; margin-top: .35rem; padding: .7rem .85rem; font: inherit; color: var(--navy-900); background: #fff; border: 1px solid var(--navy-200); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(233, 172, 44, .25); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--navy-800); }
.ltr-input { text-align: right; }
.hint { display: block; color: var(--navy-500); margin-top: .25rem; font-weight: 400; }
.error { display: block; color: var(--red); font-weight: 700; margin-top: .3rem; }
.grid-2 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 12px; padding: .65rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer; color: #fff; background: var(--navy-800); text-decoration: none !important; transition: background .15s, opacity .15s; }
.btn:hover { background: var(--navy-700); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--navy-900); }
.btn-success { background: var(--green); }
.btn-success:hover { background: #0b6140; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .35); padding: .35rem .8rem; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-small { padding: .3rem .65rem; font-size: .78rem; background: var(--navy-50); color: var(--navy-800); border: 1px solid var(--navy-200); }
.btn-small:hover { background: var(--navy-100); }
.btn-block { width: 100%; padding: .95rem; font-size: 1.05rem; border-radius: 16px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: #1d4fa8; cursor: pointer; text-decoration: underline; }

.alert { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 700; font-size: .92rem; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid #f3c1c5; }
.alert-ok { background: var(--green-bg); color: var(--green); border: 1px solid #b9e3cf; }
.alert-warn { background: var(--amber-bg); color: #8a5b00; border: 1px solid var(--gold-300); }
.alert-secret { background: #fffbea; border: 2px dashed var(--gold-500); color: var(--navy-900); font-weight: 400; }
.secret { font-size: 1.35rem; font-weight: 700; letter-spacing: .08em; background: #fff; padding: .5rem .8rem; border-radius: 10px; user-select: all; display: inline-block; margin: .4rem 0; }

/* الاستمارة */
.upload-box { margin-top: .35rem; border: 2px dashed var(--navy-200); border-radius: 12px; background: var(--navy-50); min-height: 9.5rem; overflow: hidden; }
.upload-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; height: 9.5rem; padding: .5rem; text-align: center; cursor: pointer; color: var(--navy-500); font-size: .8rem; font-weight: 400; }
.upload-pick:hover { background: var(--gold-50); }
.cam { font-size: 1.7rem; }
.upload-preview img { display: block; width: 100%; height: 8.2rem; object-fit: cover; }
.upload-preview { border: 0; background: var(--green-bg); }
.upload-remove { width: 100%; border: 0; border-top: 1px solid #b9e3cf; background: transparent; color: var(--red); font: inherit; font-size: .8rem; font-weight: 700; padding: .4rem; cursor: pointer; }
.ack { display: flex; gap: .7rem; align-items: flex-start; margin: .5rem 0 .3rem; font-size: .95rem; }
.legal-warning { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid #e8a2a7; border-inline-start: 4px solid var(--red); border-radius: 12px; background: var(--red-bg); color: #9c1e26; font-size: .92rem; line-height: 1.8; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }
.check input { width: auto; }
.reference { display: inline-block; background: var(--navy-900); color: var(--gold-300); font-size: 1.6rem; font-weight: 900; letter-spacing: .12em; padding: .55rem 1.4rem; border-radius: 12px; margin: .3rem 0 1rem; }
.ok-mark { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto .5rem; border-radius: 50%; background: var(--green-bg); color: var(--green); font-size: 2rem; }

/* الدخول */
.login-wrap { display: grid; place-items: center; min-height: 70vh; }
.login { width: 100%; max-width: 420px; text-align: center; }
.login .field { text-align: right; }
.login .link { display: block; margin: .9rem auto 0; }

/* شريط اللوحة */
.topbar { background: var(--navy-900); color: #fff; }
@media (min-width: 900px) { .topbar { position: sticky; top: 0; z-index: 50; } }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .6rem 1rem; display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; }
.brand { display: flex; flex-direction: column; line-height: 1.3; }
.brand strong { color: var(--gold-400); font-weight: 900; }
.brand span { font-size: .75rem; color: var(--navy-300); }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a.nav-portal { background: rgba(255,255,255,.12); } .nav a { color: var(--navy-200); padding: .35rem .8rem; border-radius: 10px; font-weight: 700; font-size: .9rem; text-decoration: none; }
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.logout { display: flex; gap: .6rem; align-items: center; margin: 0; }
.who { font-size: .8rem; color: var(--navy-300); }

/* القوائم */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); padding: .9rem 1rem; }
.stat span { display: block; font-size: .78rem; color: var(--navy-500); }
.stat strong { font-size: 1.7rem; font-weight: 900; }
.label { font-weight: 700; font-size: .85rem; margin-bottom: .35rem; }
.select-all { user-select: all; cursor: pointer; font-size: .78rem; background: var(--navy-50); text-align: left; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters label { font-size: .78rem; color: var(--navy-500); }
.filters select, .filters input { min-width: 10rem; margin-top: .25rem; padding: .5rem .7rem; }
.filters .grow { flex: 1 1 14rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 1rem; max-height: 8.5rem; overflow-y: auto; padding: .3rem; border: 1px solid var(--navy-100); border-radius: 12px; background: #fff; }
.chip { background: #fff; border: 1px solid var(--navy-200); color: var(--navy-700); border-radius: 999px; padding: .25rem .8rem; font-size: .8rem; font-weight: 700; text-decoration: none !important; }
.chip:hover { background: var(--navy-50); }
.chip.on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); margin-bottom: 1rem; }
.table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: .9rem; }
.table th { background: var(--navy-50); color: var(--navy-500); font-weight: 700; text-align: right; padding: .7rem .75rem; white-space: nowrap; }
.table td { padding: .65rem .75rem; border-top: 1px solid var(--navy-50); vertical-align: top; }
.table tbody tr:hover { background: #fafbfd; }
.table tr.off { opacity: .55; }
.empty { text-align: center; color: var(--navy-300); padding: 2.5rem 1rem !important; }
.actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.actions form { margin: 0; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin: 1rem 0; }
.page { min-width: 2.2rem; text-align: center; padding: .3rem .7rem; border-radius: 8px; background: #fff; color: var(--navy-700); border: 1px solid var(--navy-100); text-decoration: none !important; }
.page.current { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.gap { padding: .3rem .3rem; color: var(--navy-300); }
.pill { background: var(--navy-100); color: var(--navy-600); border-radius: 999px; padding: .25rem .8rem; font-size: .78rem; }

/* التفاصيل */
.detail-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .detail-grid { grid-template-columns: 3fr 2fr; } }
dl { margin: 0; }
.kv { display: flex; flex-direction: column; gap: .1rem; padding: .65rem 0; border-bottom: 1px solid var(--navy-50); }
.kv:last-child { border-bottom: 0; }
@media (min-width: 640px) { .kv { flex-direction: row; gap: 1rem; align-items: baseline; } }
.kv dt { width: 11rem; flex-shrink: 0; color: var(--navy-500); font-size: .8rem; }
.kv dd { margin: 0; font-weight: 700; }
.doc { margin: 0 0 1.1rem; }
.doc figcaption { display: flex; justify-content: space-between; gap: .5rem; font-weight: 700; font-size: .85rem; margin-bottom: .35rem; }
.doc .links { display: flex; gap: .8rem; font-weight: 400; font-size: .78rem; }
.doc img { display: block; width: 100%; max-height: 18rem; object-fit: contain; background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 10px; }
.stack > .card:last-child { margin-bottom: 0; }

/* الحساب */
.narrow-form { max-width: 26rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; }
.inline-form .field { margin: 0; min-width: 11rem; flex: 1 1 11rem; }
.qr-row { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; margin: 1rem 0; }
.qr { width: 11rem; height: 11rem; image-rendering: pixelated; border: 1px solid var(--navy-100); border-radius: 10px; background: #fff; }

.logo { display: block; margin: 0 auto .6rem; max-width: 60%; height: auto; }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a11f25; }
.danger-card { border-color: #f3c1c5; }
.row-actions { display: flex; gap: .6rem; align-items: center; }
.edit-link { margin-top: .6rem; }
.edit-link summary { cursor: pointer; color: #1d4fa8; font-weight: 700; font-size: .85rem; }
.spaced { margin: .6rem 0 0; }

/* نسخة المتقدم (تُحفظ كـ PDF بالطباعة) */
.receipt { margin: 1rem auto; max-width: 34rem; text-align: right; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.receipt-table td { border: 1px solid var(--navy-200); padding: .45rem .7rem; }
.receipt-table td:first-child { width: 38%; background: var(--navy-50); color: var(--navy-600); font-weight: 700; }
.receipt-actions { margin: 1rem 0 .5rem; }
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .page-head, .note, #apply-form, .no-print, noscript { display: none !important; }
  .print-only { display: block !important; }
  .container-narrow { padding: 0; max-width: none; }
  .card.success { border: 0; box-shadow: none; padding: 0; }
  .ok-mark { display: none; }
  .reference { background: none; color: #000; border: 2px solid #000; }
  .receipt-table td { border-color: #000; }
  .receipt-table td:first-child { background: #eee; color: #000; }
}
.opt { color: var(--navy-500); font-weight: 400; font-size: .8rem; }
.ack-alert { margin: 1rem 0 .4rem; padding: 1rem 1.1rem; border: 2px solid var(--red); border-radius: 12px; background: var(--red-bg); color: #9c1e26; font-weight: 700; font-size: .95rem; line-height: 1.9; }
.ack-alert input { width: 1.3rem; height: 1.3rem; margin-top: .45rem; accent-color: var(--red); flex-shrink: 0; }
#results { scroll-margin-top: 1rem; }
.report-lines { list-style: none; margin: 0 0 1rem; padding: 0; line-height: 2.1; }
.report-lines li.total { font-weight: 700; border-bottom: 1px dashed var(--navy-200); margin-bottom: .35rem; }
.narrow-table { min-width: 0; }
.sum-row td { background: var(--navy-50); }
textarea { display: block; resize: vertical; min-height: 8rem; line-height: 1.8; margin-top: .35rem; padding: .7rem .85rem; font: inherit; color: var(--navy-900); background: #fff; border: 1px solid var(--navy-200); border-radius: 12px; outline: none; }
.contact-card { margin-top: 1.6rem; }
@media print { .contact-card { display: none !important; } }
.msg-text { white-space: pre-wrap; margin: .4rem 0 0; }
.msg-card.done { opacity: .65; }
.nav .badge { background: var(--gold-500); color: var(--navy-900); border-radius: 999px; padding: 0 .45rem; font-size: .72rem; margin-inline-start: .3rem; }
.contact-link { text-align: center; margin: 1.4rem 0 0; font-weight: 700; }
.contact-link a { color: #1d4fa8; }
@media print { .contact-link { display: none !important; } }
.btn-secondary { background: var(--navy-50); color: var(--navy-800); border: 1px solid var(--navy-200); }
.btn-secondary:hover { background: var(--navy-100); }
.receipt-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.lookup { margin-top: 1.5rem; }
.lookup-row { display: flex; gap: .6rem; }
.lookup-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
#lookup-result { margin-top: 1rem; }

/* ---- حسابات المتقدمين (/me) */
.camera-box { position: relative; aspect-ratio: 1 / 1; max-width: 360px; margin: 1rem auto; border-radius: 18px; overflow: hidden; background: var(--navy-900); }
.camera-box video, .camera-box img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.camera-box img { transform: none; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; text-decoration: none; color: inherit; margin-top: .6rem; }
.ticket-row:hover { border-color: var(--navy-300); }
.pill-open { background: var(--amber-bg); color: #8a5a00; }
.pill-answered { background: var(--green-bg); color: var(--green); }
.pill-closed { background: var(--navy-100); color: var(--navy-600); }
.bubble { border-radius: 14px; padding: .7rem 1rem; margin: .6rem 0; max-width: 92%; }
.bubble.mine { background: var(--navy-50); border: 1px solid var(--navy-200); margin-inline-start: auto; }
.bubble.staff { background: var(--gold-50); border: 1px solid var(--gold-300); }
.bubble .msg-text { margin: .3rem 0 0; white-space: pre-wrap; }
.face-pair { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; }
.face-pair figure { margin: 0; flex: 1 1 240px; text-align: center; }
.face-pair img { max-width: 100%; max-height: 320px; border-radius: 12px; border: 1px solid var(--navy-200); }
.face-pair figcaption { font-weight: 700; margin-bottom: .3rem; color: var(--navy-600); }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .45rem 0; border-bottom: 1px solid var(--navy-100); }
.id-box { aspect-ratio: auto; max-width: 420px; background: var(--navy-50); border: 1px solid var(--navy-200); }
.id-box img { transform: none; height: auto; object-fit: contain; }
.spinner { width: 42px; height: 42px; margin: 1rem auto; border-radius: 50%; border: 4px solid var(--navy-200); border-top-color: var(--navy-800); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#step-card .upload-pick { border: 2px dashed var(--navy-200); border-radius: 14px; height: 7rem; }

.help-box { margin: 1.25rem 0 .5rem; text-align: center; }
.help-note { text-align: start; margin: .75rem auto 0; max-width: 34rem; }
.help-note p { margin: 0 0 .6rem; }

.search-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; color: var(--navy-200); border: 1px solid rgba(255, 255, 255, .25); text-decoration: none; }
.search-icon:hover, .search-icon[aria-expanded="true"] { background: rgba(255, 255, 255, .14); color: #fff; }
.search-backdrop { position: fixed; inset: 0; background: rgba(15, 28, 48, .45); z-index: 90; }
.search-pop { position: fixed; top: 4.5rem; inset-inline: 0; margin-inline: auto; width: min(92vw, 36rem); z-index: 100; background: #fff; border-radius: 16px; padding: .8rem; box-shadow: 0 18px 50px -10px rgba(15, 28, 48, .45); border: 1px solid var(--navy-200); }
.search-pop form { display: flex; gap: .5rem; align-items: center; margin: 0; }
.search-pop input { flex: 1; min-width: 0; padding: .65rem .9rem; border-radius: 12px; border: 1px solid var(--navy-200); font: inherit; }
.search-pop input:focus { outline: 2px solid var(--gold-500); }
.search-close { background: transparent; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--navy-500); padding: .3rem .5rem; }
@media print { .search-icon, .search-pop, .search-backdrop { display: none !important; } }

.file-row { display: flex; gap: 1rem; align-items: flex-start; padding: .9rem 0; border-top: 1px solid var(--navy-100); flex-wrap: wrap; }
.file-thumb { width: 150px; min-height: 90px; display: flex; align-items: center; justify-content: center; background: var(--navy-50); border-radius: 10px; overflow: hidden; }
.file-thumb img { max-width: 100%; max-height: 130px; display: block; }
.file-actions { flex: 1 1 260px; display: flex; flex-direction: column; gap: .5rem; }
.file-actions form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }

/* ---- هيكل اللوحة: شريط جانبي أيمن + شريط علوي */
body.panel-shell { background: var(--navy-50); }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 17rem; flex: none; background: #0f2a3d; color: #dbe5ef; padding: 1rem .8rem 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; flex-direction: column; align-items: center; gap: .15rem; text-align: center; padding: .4rem 0 1rem; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: .8rem; }
.side-brand img { background: #fff; border-radius: 12px; padding: .25rem .5rem; width: 64px; height: auto; margin-bottom: .3rem; }
.side-brand strong { color: #fff; font-size: .98rem; } .side-brand span { font-size: .78rem; color: var(--navy-300); }
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.side-group { margin-top: .5rem; } .side-group > summary { cursor: pointer; list-style: none; font-size: .78rem; color: var(--gold-400); font-weight: 700; padding: .5rem .6rem .3rem; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-link { display: flex; align-items: center; gap: .6rem; color: #dbe5ef; text-decoration: none; padding: .5rem .7rem; border-radius: 10px; font-size: .92rem; font-weight: 700; border-inline-start: 3px solid transparent; }
.side-link:hover { background: rgba(255, 255, 255, .08); }
.side-link.active { background: rgba(255, 255, 255, .14); color: #fff; border-inline-start-color: var(--gold-500); }
.side-ico { display: inline-flex; opacity: .85; } .side-link .badge { margin-inline-start: auto; background: var(--gold-500); color: #0f1c30; border-radius: 999px; padding: 0 .45rem; font-size: .72rem; }
.shell-main { flex: 1; min-width: 0; }
.topbar2 { background: #fff; border-bottom: 1px solid var(--navy-200); padding: .55rem 1.2rem; display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 40; }
.top-title { margin: 0; font-size: 1.05rem; color: var(--navy-900); flex: 1; }
.top-actions { display: flex; align-items: center; gap: .6rem; }
.topbar2 .search-icon { color: var(--navy-700); border-color: var(--navy-200); background: #fff; }
.topbar2 .search-icon:hover { background: var(--navy-50); color: var(--navy-900); }
.side-toggle { display: none; background: transparent; border: 1px solid var(--navy-200); border-radius: 10px; padding: .45rem .55rem; cursor: pointer; }
.side-toggle span { display: block; width: 20px; height: 2px; background: var(--navy-800); margin: 4px 0; }
.user-menu { position: relative; } .user-menu > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; line-height: 1.25; padding: .2rem .5rem; border-radius: 10px; }
.user-menu > summary::-webkit-details-marker { display: none; } .user-menu > summary:hover { background: var(--navy-50); }
.who-name { font-weight: 700; font-size: .88rem; color: var(--navy-900); } .who-role { font-size: .74rem; color: var(--navy-500); }
.user-pop { position: absolute; inset-inline-end: 0; top: 100%; min-width: 12rem; background: #fff; border: 1px solid var(--navy-200); border-radius: 12px; box-shadow: var(--shadow); padding: .4rem; z-index: 60; }
.user-pop a, .user-pop button { display: block; width: 100%; text-align: start; padding: .5rem .7rem; border: 0; background: transparent; font: inherit; border-radius: 8px; color: var(--navy-900); text-decoration: none; cursor: pointer; }
.user-pop a:hover, .user-pop button:hover { background: var(--navy-50); } .user-pop form { margin: 0; }
.side-backdrop { position: fixed; inset: 0; background: rgba(15, 28, 48, .5); z-index: 80; }
body.panel-shell main.container { padding-block: 1.2rem 3rem; }
@media (max-width: 899px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 90; transform: translateX(100%); transition: transform .2s; width: min(82vw, 17rem); }
  .sidebar.open { transform: none; }
  .side-toggle { display: block; }
}
@media print { .sidebar, .topbar2 { display: none; } }

/* ---- لوحة المعلومات والجداول والنماذج الجديدة */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat-card { background: #fff; border: 1px solid var(--navy-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .15rem; }
.stat-card:hover { border-color: var(--navy-500); }
.stat-value { font-size: 1.9rem; font-weight: 900; color: var(--navy-900); line-height: 1.2; } .stat-label { font-size: .88rem; color: var(--navy-600); } .stat-hint { font-size: .78rem; color: var(--navy-500); }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; align-items: start; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: .45rem 0; border-bottom: 1px solid var(--navy-100); }
.table-card { padding: 0; overflow-x: auto; }
.list-table { width: 100%; border-collapse: collapse; } .list-table th, .list-table td { padding: .65rem .9rem; text-align: start; border-bottom: 1px solid var(--navy-100); }
.list-table th { background: var(--navy-50); font-size: .82rem; color: var(--navy-600); }
.field.check label { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.media-pick { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; } .media-current { max-width: 14rem; border-radius: 10px; border: 1px solid var(--navy-200); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .8rem; }
.media-item { padding: .6rem; margin: 0; } .media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.media-item figcaption { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; } .inline-form { display: flex; gap: .3rem; } .inline-form input { flex: 1; min-width: 0; }
.danger-zone { border-color: #f1c1c4; } .color-field { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; } .color-field label { flex: 1 0 100%; }

.dash-sec { margin: 1.4rem 0 .6rem; font-size: 1.05rem; color: var(--navy-600); }
.fb-field { background: #fff; border: 1px solid var(--navy-200); border-radius: 12px; padding: .5rem .9rem; margin: .5rem 0; }
.fb-field > summary { cursor: pointer; padding: .3rem 0; } .fb-form { display: grid; gap: .6rem; margin: .6rem 0; } .fb-form label { display: grid; gap: .2rem; font-weight: 700; }
.fb-form input:not([type="checkbox"]), .fb-form select, .fb-form textarea { padding: .5rem .7rem; border: 1px solid var(--navy-200); border-radius: 10px; font: inherit; }
.fb-form label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; } .fb-cond { border: 1px dashed var(--navy-300); border-radius: 10px; padding: .6rem; }
.inline-grid { display: grid; gap: .6rem; margin-bottom: .8rem; } .inline-grid label, .actions-grid label { display: grid; gap: .25rem; font-weight: 700; }
.inline-grid select, .inline-grid textarea, .actions-grid textarea, .actions-grid select, .actions-grid input { padding: .5rem .7rem; border: 1px solid var(--navy-200); border-radius: 10px; font: inherit; width: 100%; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-top: 1rem; } .inline-form { display: flex; gap: .4rem; }
.timeline-admin { list-style: none; margin: 0; padding: 0; } .timeline-admin li { border-inline-start: 3px solid var(--gold-500); padding: .4rem .9rem .7rem; margin-bottom: .4rem; background: var(--navy-50); border-radius: 0 10px 10px 0; }
.timeline-admin li.internal { border-inline-start-color: var(--navy-300); background: #fff; }
.filters.slim { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; padding: .8rem 1rem; margin-bottom: 1rem; } .filters.slim label { display: grid; gap: .2rem; font-size: .8rem; }
.pager { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 1rem; } .pager a { padding: .35rem .7rem; border: 1px solid var(--navy-200); border-radius: 10px; background: #fff; text-decoration: none; } .pager a.on { background: var(--navy-800); color: #fff; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .8rem; }
.doc-grid figure { margin: 0; text-align: center; background: var(--navy-50); border: 1px solid var(--navy-200); border-radius: 12px; padding: .5rem; }
.doc-grid img { width: 100%; height: 11rem; object-fit: contain; border-radius: 8px; background: #fff; display: block; }
.doc-grid figcaption { font-size: .82rem; margin-top: .3rem; color: var(--navy-600); }

/* ---- حساب المواطن: لوحة، ملف شخصي، معاملات، مواعيد، تنبيهات ---- */
.hero-card { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); color: #fff; border-radius: 16px; padding: 1.2rem 1.4rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.hero-card h1 { margin: 0 0 .2rem; color: #fff; font-size: 1.45rem; } .hero-card .muted, .hero-card a:not(.btn) { color: var(--navy-100); }
.hero-card > div:not(.hero-actions) { flex: 1; min-width: 12rem; } .hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--navy-100); border: 3px solid rgba(255, 255, 255, .85); flex: none; }
.avatar-lg { width: 5.5rem; height: 5.5rem; } .avatar-sm { width: 2.6rem; height: 2.6rem; }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 2rem; color: var(--navy-700); }
.profile-dl .row { display: flex; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--navy-100); } .profile-dl dt { width: 10rem; color: var(--navy-600); flex: none; } .profile-dl dd { margin: 0; font-weight: 700; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.pill-warn { background: #fde8d8; color: #9a3d00; } .alert-warn { background: #fff4dd; border: 1px solid #f0cf86; color: #6b4a00; border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; }
.stepper { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; } .stepper li { flex: 1; text-align: center; font-size: .82rem; color: var(--navy-500); } .stepper li span { display: flex; margin: 0 auto .25rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--navy-100); align-items: center; justify-content: center; font-weight: 800; }
.stepper li.done span { background: var(--green); color: #fff; } .stepper li.now span { background: var(--gold-500); color: var(--navy-900); } .stepper li.now { color: var(--navy-900); font-weight: 800; }
.stepper.ended { color: var(--navy-600); font-weight: 800; }
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--navy-200); } .timeline li { padding: .2rem 1rem .8rem; position: relative; } .timeline li::before { content: ""; position: absolute; inset-inline-start: -.45rem; top: .45rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--navy-500); } .timeline .tl-date { display: block; font-size: .78rem; color: var(--navy-500); } .timeline p { margin: .2rem 0 0; }
.appt-card { display: flex; gap: 1rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--navy-100); flex-wrap: wrap; } .appt-card > div:nth-child(2) { flex: 1; min-width: 10rem; } .appt-when { display: flex; flex-direction: column; background: var(--navy-50); border: 1px solid var(--navy-200); border-radius: 10px; padding: .4rem .9rem; text-align: center; min-width: 8rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .7rem; } .choice { display: flex; flex-direction: column; gap: .2rem; border: 2px solid var(--navy-200); border-radius: 12px; padding: .8rem 1rem; text-decoration: none; color: inherit; background: #fff; } .choice:hover { border-color: var(--navy-500); } .choice.on { border-color: var(--gold-500); background: #fffaf0; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; margin-bottom: 1rem; } .slot input { position: absolute; opacity: 0; } .slot span { display: block; text-align: center; border: 2px solid var(--navy-200); border-radius: 10px; padding: .5rem; font-weight: 800; background: #fff; cursor: pointer; } .slot input:checked + span { background: var(--navy-900); color: #fff; border-color: var(--navy-900); } .slot input:focus-visible + span { outline: 3px solid var(--gold-500); } .slot.off span { opacity: .4; text-decoration: line-through; cursor: not-allowed; } .slot { position: relative; }
.notif-list { list-style: none; margin: 0; padding: 0; } .notif-list li a { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border-bottom: 1px solid var(--navy-100); text-decoration: none; color: inherit; } .notif-list li.unread a { background: #fffaf0; border-inline-start: 4px solid var(--gold-500); } .notif-list li a:hover { background: var(--navy-50); } .notif-kind { align-self: flex-start; background: var(--navy-100); color: var(--navy-700); border-radius: 999px; font-size: .72rem; padding: 0 .55rem; }
.appt-next p { margin: .3rem 0; }
.fig-tools { margin-top: .4rem; text-align: start; font-size: .82rem; } .fig-tools summary { cursor: pointer; color: var(--navy-600); } .fig-tools form { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; } .fig-tools input[type=file] { max-width: 100%; } .fig-rotate { display: flex; gap: .3rem; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: flex-start; } .inline-form { display: inline; } .archive-form { border-top: 1px dashed var(--navy-200); margin-top: 1rem; padding-top: .6rem; }
fieldset.hours { border: 1px solid var(--navy-200); border-radius: 10px; margin: 1rem 0; padding: .6rem 1rem; } fieldset.hours legend { font-weight: 800; padding: 0 .4rem; font-size: .9rem; } fieldset.hours input[type=time] { width: 7.5rem; }
@media (max-width: 640px) { .hero-card { padding: 1rem; } .profile-dl .row { flex-direction: column; gap: .1rem; } .profile-dl dt { width: auto; } }
@media (max-width: 760px) {
  .topbar-inner { gap: .4rem .8rem; }
  .topbar .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar .nav a { white-space: nowrap; }
  .topbar .logout { margin-inline-start: auto; }
}

/* ---- تحليلات اللوحة والتقارير ---- */
svg.bars { width: 100%; height: 9rem; display: block; background: var(--navy-50); border-radius: 10px; padding: .4rem; box-sizing: border-box; } svg.bars .bar { fill: var(--navy-500); } svg.bars .bar:hover { fill: var(--gold-500); }
.bars-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--navy-500); margin-top: .25rem; }
.late { color: #b3261e; }
.report-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.num { font-variant-numeric: tabular-nums; }
@media print { .sidebar, .topbar2, .report-actions, .filters, .side-backdrop, .search-pop, .search-backdrop { display: none !important; } .shell-main { margin: 0 !important; } .card { break-inside: avoid; box-shadow: none; } }

/* ---- منشئ النماذج: سحب وإفلات + الحقول المحسوبة ---- */
.drag-handle { cursor: grab; color: var(--navy-500); font-size: 1.1rem; margin-inline-end: .3rem; } .fb-field.dragging { opacity: .45; outline: 2px dashed var(--gold-500); }
output.computed { display: block; padding: .55rem .8rem; background: var(--navy-50, #eef2f8); border: 1px dashed var(--navy-300, #9fb0cc); border-radius: 8px; font-weight: 800; }
ol.approvals { list-style: none; padding: 0; margin: 0 0 .8rem; } ol.approvals li { padding: .45rem .2rem; border-bottom: 1px solid var(--navy-100); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ---- المحتوى: جداول وصور داخل النص، الاختيار من الوسائط، الألبومات ---- */
.table-wrap { overflow-x: auto; margin: 1rem 0; } table.body-table { border-collapse: collapse; width: 100%; } table.body-table th, table.body-table td { border: 1px solid var(--navy-200, #cdd6e6); padding: .5rem .7rem; text-align: start; } table.body-table th { background: var(--navy-50, #f1f4fa); }
figure.body-img { margin: 1.2rem 0; text-align: center; } figure.body-img img { max-width: 100%; border-radius: 10px; } figure.body-img figcaption { font-size: .85rem; color: #5b6b86; margin-top: .3rem; }
.video-link a { display: inline-block; padding: .55rem 1rem; background: #0f1c30; color: #fff; border-radius: 10px; text-decoration: none; font-weight: 800; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .5rem; margin: .6rem 0 1rem; } .pick { position: relative; cursor: pointer; } .pick img { width: 100%; height: 5.5rem; object-fit: cover; border-radius: 8px; border: 2px solid transparent; display: block; } .pick input { position: absolute; top: .3rem; inset-inline-start: .3rem; } .pick input:checked + img { border-color: var(--gold-500); }
.syntax-help pre { background: var(--navy-50, #f1f4fa); padding: .6rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; } pre.rev-body { white-space: pre-wrap; background: var(--navy-50, #f1f4fa); padding: .6rem; border-radius: 8px; max-height: 16rem; overflow: auto; }
.timeline-admin { list-style: none; padding: 0; margin: 0; } .timeline-admin li { padding: .6rem 0; border-bottom: 1px solid var(--navy-100, #e4e9f2); }
.media-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1.2rem; } .media-tabs a { padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--navy-200, #cdd6e6); text-decoration: none; font-weight: 700; color: inherit; } .media-tabs a.on { background: #0f1c30; color: #fff; border-color: #0f1c30; }
.album-grid, .video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; } .album-card, .video-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--navy-200, #cdd6e6); border-radius: 12px; overflow: hidden; background: #fff; } .album-card img, .video-card img { width: 100%; height: 11rem; object-fit: cover; display: block; background: #e8edf5; } .album-card .cap, .video-card .cap { padding: .7rem .9rem; display: flex; flex-direction: column; gap: .2rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .8rem; } .photo-grid figure { margin: 0; } .photo-grid img { width: 100%; height: 11rem; object-fit: cover; border-radius: 10px; display: block; } .photo-grid figcaption { font-size: .85rem; color: #5b6b86; margin-top: .25rem; }
.update-list { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid #cdd6e6; } .update-list li { padding: .2rem 1rem .9rem; position: relative; } .update-list li::before { content: ""; position: absolute; inset-inline-start: -.45rem; top: .45rem; width: .8rem; height: .8rem; border-radius: 50%; background: #3b5a8c; }
code.temp-pass { display: inline-block; font-size: 1.6rem; letter-spacing: .12em; padding: .6rem 1.2rem; background: #fffaf0; border: 2px dashed var(--gold-500); border-radius: 10px; user-select: all; }
.optional-doc label::after { content: " (اختياري)"; color: var(--navy-500); font-weight: 400; }
.optional-doc .req { display: none; }
