/* منصة تدبير الحضور — RGHSESTM */
@font-face { font-family: Cairo; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/cairo-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/cairo-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/cairo-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/cairo-arabic-800-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/cairo-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/cairo-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/cairo-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Cairo; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/cairo-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --navy: #0f2347; --navy-2: #1a3a6b; --blue: #2563a8; --gold: #c8a951; --gold-d: #9e7d2a;
  --ok: #1f8a5b; --warn: #c77700; --bad: #c0392b;
  --ink: #16213a; --ink-2: #46506a; --ink-3: #6b7490; --line: #e2e6f0; --bg: #f4f6fb; --card: #fff;
  --r: 14px; --r-lg: 20px; --sh: 0 6px 24px rgba(15, 35, 71, .09); --sh-lg: 0 20px 60px rgba(8, 20, 45, .35);
  --font: Cairo, 'Segoe UI', Tahoma, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15.5px/1.7 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .4em; color: var(--navy); }
h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.ico { flex: none; vertical-align: middle; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ── الأزرار ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 20px; border-radius: 999px; border: 2px solid transparent; font: 700 .95rem/1.2 var(--font); cursor: pointer; text-decoration: none !important; transition: transform .15s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy-2); color: #fff; box-shadow: 0 6px 16px rgba(26, 58, 107, .25); }
.btn-primary:hover:not(:disabled) { background: var(--navy); }
.btn-gold { background: linear-gradient(135deg, #d9bc63, var(--gold)); color: var(--navy); box-shadow: 0 8px 20px rgba(200, 169, 81, .35); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 8px 20px rgba(31, 138, 91, .3); }
.btn-ghost { background: #fff; color: var(--navy-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy-2); }
.btn-outline { background: transparent; color: var(--navy-2); border-color: var(--navy-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-outline { background: #fff; color: var(--bad); border-color: rgba(192, 57, 43, .4); }
.btn-sm { min-height: 34px; padding: 5px 14px; font-size: .86rem; }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ── النماذج ── */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field > span:first-child { font-weight: 700; font-size: .9rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field small { color: var(--ink-3); font-size: .8rem; line-height: 1.5; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 13px; width: 100%; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 80px; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 168, .12); }
input[dir="ltr"] { text-align: left; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--navy-2); }
fieldset { border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 16px 16px; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 800; color: var(--navy); padding: 0 6px; }
.radio, .check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pw { position: relative; display: block; }
.pw input { padding-inline-end: 44px; }
.pw-eye { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--ink-3); padding: 8px; cursor: pointer; border-radius: 8px; }
.pw-eye.done { color: var(--ok); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.narrow { max-width: 560px; }

/* ── التنبيهات ── */
.flashes { display: grid; gap: 8px; margin: 0 0 16px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: .93rem; border: 1px solid; margin: 0 0 12px; transition: opacity .5s; }
.flashes .flash { margin: 0; }
.flash .ico { margin-top: 3px; }
.flash-ok { background: #e7f6ee; border-color: #bfe5d0; color: #145c3d; }
.flash-error { background: #fdecea; border-color: #f5c6c0; color: #8f2a1f; }
.flash-warn { background: #fff5e0; border-color: #f2d9a6; color: #7a4a00; }
.flash-info { background: #eaf1fb; border-color: #c9dbf3; color: #1a3a6b; }
.flash a { color: inherit; text-decoration: underline; }
.flash.fade { opacity: 0; }

/* ══════════ الصفحات العامة (خلفية المدرج) ══════════ */
body.public { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--navy); color: var(--ink); }
.hall-bg { position: fixed; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(15, 35, 71, .9) 0%, rgba(26, 58, 107, .78) 50%, rgba(15, 35, 71, .94) 100%), url(../img/hall.jpg) center / cover no-repeat; }
@media (max-width: 700px) { .hall-bg { background-image: linear-gradient(160deg, rgba(15, 35, 71, .9), rgba(26, 58, 107, .82) 50%, rgba(15, 35, 71, .95)), url(../img/hall-sm.jpg); } }
.public-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: clamp(16px, 4vw, 48px) 16px; display: flex; flex-direction: column; justify-content: center; }
.public-foot { text-align: center; color: rgba(255, 255, 255, .6); font-size: .8rem; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }

.hero-card { background: rgba(255, 255, 255, .97); border-radius: 26px; box-shadow: var(--sh-lg); overflow: hidden; }
.hero-logo { background: #fff; padding: clamp(10px, 2vw, 18px) clamp(14px, 3vw, 30px); border-bottom: 5px solid var(--gold); }
.hero-logo img, .auth-logo img, .invite-logo img { display: block; width: 100%; height: auto; }
.hero-body { padding: clamp(22px, 4vw, 44px) clamp(18px, 5vw, 56px) clamp(26px, 4vw, 44px); text-align: center; background: radial-gradient(ellipse at top, #f7f2e3 0%, #fff 60%); }
.hero-kicker { color: var(--ink-3); font-size: .9rem; font-weight: 600; margin: 0 0 10px; }
.hero-title { font-size: clamp(1.75rem, 5.4vw, 3.2rem); line-height: 1.3; font-weight: 800; color: var(--navy); margin: 0 0 12px; }
.hero-title span { display: inline-block; background: linear-gradient(135deg, var(--gold-d), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-team { font-size: clamp(1rem, 2.2vw, 1.25rem); font-weight: 700; color: var(--navy-2); margin: 0 0 24px; }
.hero-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 26px; }
.hero-features div { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.hero-features .ico { color: var(--gold-d); width: 30px; height: 30px; }
.hero-actions { margin: 0 0 18px; }
.hero-note { color: var(--ink-3); font-size: .86rem; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; }

.auth-card { width: 100%; max-width: 440px; margin: 0 auto; background: #fff; border-radius: 22px; box-shadow: var(--sh-lg); padding: 0 clamp(18px, 5vw, 34px) 26px; text-align: center; overflow: hidden; }
.auth-card .form { text-align: start; margin: 18px 0 14px; }
.auth-logo { display: block; margin: 0 calc(-1 * clamp(18px, 5vw, 34px)) 18px; padding: 12px 18px; border-bottom: 4px solid var(--gold); }
.auth-note { color: var(--ink-3); font-size: .8rem; display: flex; gap: 6px; align-items: center; justify-content: center; margin: 0; }
.install-card { max-width: 640px; }
.reqs { text-align: start; margin: 0 0 14px; background: var(--bg); border-radius: 12px; padding: 8px 14px; }
.reqs summary { cursor: pointer; font-weight: 700; }
.reqs ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.reqs li.ok .ico { color: var(--ok); } .reqs li.bad { color: var(--bad); font-weight: 700; }
.msg-card { padding-top: 30px; }
.msg-ico { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--bg); color: var(--navy-2); margin-bottom: 10px; }

/* صفحة الدعوة */
.invite-card { width: 100%; max-width: 520px; margin: 0 auto; background: #fff; border-radius: 24px; box-shadow: var(--sh-lg); overflow: hidden; text-align: center; }
.invite-logo { padding: 10px 16px; background: #fff; }
.invite-head { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; padding: 20px 22px; border-top: 4px solid var(--gold); }
.invite-head h1 { color: #fff; font-size: clamp(1.15rem, 4vw, 1.45rem); margin: 4px 0 0; }
.invite-kicker { color: var(--gold); font-weight: 800; font-size: .85rem; letter-spacing: .03em; }
.invite-body { padding: 20px clamp(16px, 5vw, 30px) 26px; }
.invite-name { font-size: 1.1rem; font-weight: 800; color: var(--navy); margin: 0 0 8px; }
.invite-line { background: #f7f2e3; border-radius: 12px; padding: 10px 14px; margin: 12px 0 0; font-weight: 600; color: var(--ink-2); }
.invite-facts { list-style: none; margin: 16px 0; padding: 12px 16px; background: var(--bg); border-radius: 14px; display: grid; gap: 8px; text-align: start; }
.invite-facts li { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.invite-facts .ico { color: var(--gold-d); margin-top: 3px; }
.invite-qr { margin-top: 16px; padding: 18px; border: 2px dashed var(--line); border-radius: 18px; }
.invite-qr-title { font-weight: 800; color: var(--navy); margin: 0 0 10px; }
.invite-qr img { display: block; margin: 0 auto; width: min(260px, 70vw); height: auto; image-rendering: pixelated; background: #fff; border-radius: 10px; }
.invite-qr code { display: block; margin: 10px auto; font-size: .82rem; letter-spacing: .04em; word-break: break-all; }
.invite-done { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; margin: 14px 0 0; border-radius: 14px; background: #e7f6ee; color: #145c3d; }

/* ══════════ صفحات التطبيق ══════════ */
.topbar { position: sticky; top: 0; z-index: 50; background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; border-bottom: 3px solid var(--gold); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--gold); color: var(--navy); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1rem; }
.brand-text small { color: rgba(255, 255, 255, .65); font-size: .72rem; letter-spacing: .08em; }
.mainnav { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; flex-wrap: wrap; }
.mainnav a, .nav-logout button { display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .85); padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: .9rem; text-decoration: none !important; background: none; border: 0; cursor: pointer; font-family: var(--font); }
.mainnav a:hover, .nav-logout button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.mainnav a.is-active { background: rgba(200, 169, 81, .22); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.nav-user em { font-style: normal; font-size: .72rem; color: var(--gold); border: 1px solid rgba(200, 169, 81, .5); border-radius: 999px; padding: 0 7px; }
.nav-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .2); margin: 0 6px; }
.nav-logout { margin: 0; }
.nav-toggle { display: none; margin-inline-start: auto; background: rgba(255, 255, 255, .1); border: 0; border-radius: 10px; width: 44px; height: 44px; cursor: pointer; }
.nav-toggle .bars { display: grid; gap: 5px; width: 22px; margin: auto; }
.nav-toggle .bars i { display: block; height: 2px; background: #fff; border-radius: 2px; }
.app-main { max-width: 1280px; margin: 0 auto; padding: 22px 16px 60px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 1px 3px rgba(15, 35, 71, .06); }
.pad { padding: clamp(16px, 2.5vw, 26px); }
.card + .card, .card + section, section + .card { margin-top: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 0 0 18px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin: 0 0 4px !important; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink-2); font-size: .9rem; margin: 0 0 4px; }
.ev-meta .ico { color: var(--gold-d); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .ico { color: var(--line); display: block; margin: 0 auto 10px; }

.status { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 800; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.status-draft { background: #eef1f7; color: var(--ink-3); }
.status-open { background: #e7f6ee; color: var(--ok); }
.status-open::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-inline-end: 6px; animation: pulse 1.6s infinite; }
.status-closed { background: #fdecea; color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0 0 20px; counter-reset: s; }
.step { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.step b { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--navy-2); color: #fff; font-size: .85rem; }

.ev-grid, .ev-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.ev-card { display: block; padding: 18px 20px; color: inherit; text-decoration: none !important; transition: transform .2s, box-shadow .2s; border-top: 4px solid var(--navy-2); }
.ev-card:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.ev-card h2 { font-size: 1.08rem; margin: 8px 0; }
.ev-card-top { display: flex; justify-content: space-between; align-items: center; }
.ev-nums { display: flex; gap: 8px; margin: 14px 0 10px; }
.ev-nums span { flex: 1; display: flex; flex-direction: column; align-items: center; background: var(--bg); border-radius: 10px; padding: 6px 4px; font-size: .78rem; color: var(--ink-3); }
.ev-nums b { font-size: 1.3rem; color: var(--navy); line-height: 1.2; }
.ev-nums .hl { background: #e7f6ee; } .ev-nums .hl b { color: var(--ok); }
.bar { height: 7px; border-radius: 9px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), #3cc38a); border-radius: 9px; transition: width .4s; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; align-items: center; }
.tile-n { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.tile-l { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.tile-ok { background: #e7f6ee; border-color: #bfe5d0; } .tile-ok .tile-n { color: var(--ok); }
.tile-warn { background: #fff5e0; border-color: #f2d9a6; } .tile-warn .tile-n { color: var(--warn); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }

/* الفئات: لون لكل فئة */
.cat-attendee { --c: #2563a8; --cb: #eaf1fb; }
.cat-speaker { --c: #9e7d2a; --cb: #f7f0dc; }
.cat-organizer { --c: #1f8a5b; --cb: #e7f6ee; }
.cat-honor { --c: #8e2c48; --cb: #f8e9ee; }
.cat-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--c, var(--blue)); background: var(--cb, #eaf1fb); white-space: nowrap; }
.cat-pill b { font-size: .9rem; }

/* الإرسال */
.send-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.send-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.progress { margin-top: 14px; }
.progress .bar { height: 12px; }
.progress p { margin: 8px 0; font-weight: 700; }
.log { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; font-size: .82rem; }
.log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log .bad { color: var(--bad); }

/* الجدول */
.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table-tools select { width: auto; min-width: 140px; }
.search { position: relative; flex: 1; min-width: 220px; display: block; }
.search .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-inline-start: 38px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ptable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ptable th { text-align: start; font-size: .78rem; color: var(--ink-3); font-weight: 700; padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable td { padding: 10px 14px; border-bottom: 1px solid #eef1f7; vertical-align: top; }
.ptable tbody tr:hover { background: #fafbfd; }
.ptable td small { display: block; color: var(--ink-3); font-size: .8rem; line-height: 1.5; margin-top: 2px; }
.ptable.preview td, .ptable.preview th { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.inv { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.inv-pending { background: #eef1f7; color: var(--ink-3); }
.inv-sent { background: #e7f6ee; color: var(--ok); }
.inv-failed { background: #fdecea; color: var(--bad); cursor: help; }
.att-yes { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 800; }
.role { font-size: .78rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; }
.role-admin { background: #f7f0dc; color: var(--gold-d); } .role-operator { background: #eaf1fb; color: var(--blue); }
.c-act { width: 1%; text-align: end; }
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 8px; border-radius: 9px; color: var(--ink-2); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary, .menu summary:hover { background: var(--bg); }
.menu-pop { position: absolute; inset-inline-end: 0; top: 100%; z-index: 20; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh); padding: 6px; display: grid; }
.menu-pop.wide { min-width: 290px; }
.menu-pop form { margin: 0; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: 600 .88rem var(--font); cursor: pointer; text-align: start; text-decoration: none !important; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop .danger { color: var(--bad); }
.mini-form { padding: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px !important; display: grid; gap: 6px; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 14px; }
.act { font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.act-attend { background: #e7f6ee; color: var(--ok); } .act-unattend, .act-scan_denied, .act-mail_failed { background: #fdecea; color: var(--bad); }
.act-login { background: #eaf1fb; color: var(--blue); }

/* نماذج المدير */
.cat-pick { grid-template-columns: repeat(4, 1fr); }
.cat-opt input { position: absolute; opacity: 0; }
.cat-opt span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid var(--line); border-radius: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; text-align: center; transition: .15s; }
.cat-opt input:checked + span { border-color: var(--c); background: var(--cb); color: var(--c); }
.cat-opt input:focus-visible + span { outline: 3px solid var(--gold); }
.status-pick .radio span { display: inline-flex; gap: 4px; }
.danger-zone { border-color: #f5c6c0; margin-top: 24px; }
.danger-zone h2 { color: var(--bad); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 16px; border: 2px dashed #c9d3e6; border-radius: 16px; background: var(--bg); text-align: center; cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--blue); background: #eaf1fb; }
.dropzone .ico { color: var(--navy-2); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name { font-weight: 800; color: var(--ok); }
.cols-list { padding-inline-start: 20px; margin: 0 0 14px; }
.cols-list li { margin-bottom: 4px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.plain { margin: 8px 0; padding-inline-start: 20px; font-size: .88rem; }
.test-mail { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }
.settings-grid section { align-self: start; }
.users-grid { grid-template-columns: 1.6fr 1fr; align-items: start; }

/* ══════════ صفحة القراءة ══════════ */
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.scan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.scan-head h1 { font-size: clamp(1.1rem, 2.6vw, 1.45rem); margin: 0 0 10px; }
.scan-head p { margin: 0; }
.counter-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 16px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: var(--r-lg); padding: 16px 20px; margin: 0 0 14px; box-shadow: var(--sh); }
.counter-l { grid-column: 1 / -1; color: var(--gold); font-weight: 800; font-size: .85rem; }
.counter-n { font-size: 3rem; font-weight: 800; line-height: 1.1; }
.counter-n.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--gold); } }
.counter-of { color: rgba(255, 255, 255, .7); }
.counter-cats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.counter-card .cat-pill { background: rgba(255, 255, 255, .12); color: #fff; }
.camera { position: relative; overflow: hidden; aspect-ratio: 4 / 3; max-height: 540px; width: 100%; background: #0b1730; border: 0; display: grid; place-items: center; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.camera.is-on video { opacity: 1; }
.cam-frame { position: absolute; inset: 14%; pointer-events: none; opacity: 0; transition: opacity .3s; }
.camera.is-on .cam-frame { opacity: 1; }
.cam-frame i { position: absolute; width: 34px; height: 34px; border: 5px solid var(--gold); }
.cam-frame i:nth-child(1) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.cam-frame i:nth-child(2) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.cam-frame i:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.cam-frame i:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.camera.is-on .cam-frame::after { content: ''; position: absolute; inset-inline: 6%; height: 2px; background: rgba(200, 169, 81, .9); box-shadow: 0 0 12px var(--gold); animation: scanline 2.2s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { top: 8%; } 50% { top: 92%; } }
.cam-idle { position: relative; z-index: 2; text-align: center; color: rgba(255, 255, 255, .85); padding: 20px; max-width: 400px; }
.cam-idle .ico { color: var(--gold); }
.cam-idle .muted { color: rgba(255, 255, 255, .7); }
.cam-tools { position: absolute; z-index: 3; bottom: 12px; inset-inline: 12px; display: flex; justify-content: center; gap: 8px; }
.cam-tools .btn { background: rgba(255, 255, 255, .9); }
.alt-inputs { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; align-items: stretch; }
.alt-inputs .manual { margin: 0; }
.photo-btn { height: auto; min-height: 100%; border-radius: var(--r-lg); padding: 14px 20px; cursor: pointer; }
.live-panel { position: sticky; top: 80px; padding: 16px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; gap: 10px; margin: 0 !important; }
.live-head { display: flex; justify-content: space-between; align-items: center; }
.live-head h2 { margin: 0; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
.live-dot.is-off { background: var(--bad); animation: none; }
.live-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; }
.live-item { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: #fafbfd; border: 1px solid #eef1f7; border-inline-start: 4px solid var(--c); }
.live-item.is-fresh { animation: fresh 2.5s; }
@keyframes fresh { 0% { background: #fff4d1; transform: translateX(-6px); } 100% { background: #fafbfd; } }
.live-num { flex: none; min-width: 26px; text-align: center; font-size: .75rem; font-weight: 800; color: var(--ink-3); }
.live-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.live-main strong { font-size: .92rem; }
.live-main small { color: var(--ink-3); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-side { flex: none; max-width: 42%; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: end; }
.live-side time { font-size: .72rem; color: var(--ink-3); line-height: 1.35; }
.live-side .cat-pill { font-size: .7rem; padding: 1px 8px; }

/* بطاقة نتيجة القراءة */
.sheet { position: fixed; inset: 0; z-index: 100; background: rgba(8, 18, 40, .6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet-card { width: 100%; max-width: 480px; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: var(--sh-lg); animation: rise .25s; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-band { background: var(--c, var(--navy-2)); color: #fff; padding: 16px 20px; font-weight: 800; font-size: 1.15rem; text-align: center; letter-spacing: .02em; }
.sheet-card.is-error .sheet-band { background: var(--bad); }
.sheet-card.is-error .sheet-band span::before { content: 'تنبيه'; }
.sheet-body { padding: 20px 22px 22px; text-align: center; }
.sheet-state { display: inline-block; font-weight: 800; font-size: .88rem; padding: 4px 14px; border-radius: 999px; margin: 0 0 10px; background: #eef1f7; color: var(--ink-2); }
.is-done .sheet-state { background: #e7f6ee; color: var(--ok); font-size: 1rem; }
.is-already .sheet-state { background: #fff5e0; color: var(--warn); }
.is-error .sheet-state { background: #fdecea; color: var(--bad); display: block; font-size: .95rem; padding: 10px 14px; border-radius: 12px; }
.sheet-body h2 { justify-content: center; font-size: 1.5rem; margin: 0 0 4px; }
.sheet-pos { font-weight: 700; color: var(--ink-2); margin: 0 0 2px; }
.sheet-inst { color: var(--ink-3); margin: 0; }
.sheet-talk { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: #f7f0dc; display: grid; gap: 2px; }
.sheet-talk span { font-size: .78rem; font-weight: 800; color: var(--gold-d); }
.sheet-talk em { font-style: normal; font-size: .85rem; color: var(--ink-2); }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }
.is-done .sheet-actions .btn-ghost { display: none; }
.is-done .sheet-body h2::after { content: ''; }

/* شاشة العرض الكبيرة */
body.is-live .app-main { max-width: none; }
.board { max-width: 1500px; margin: 0 auto; }
.board-head { display: grid; grid-template-columns: minmax(0, 340px) 1fr auto; gap: 20px; align-items: center; background: #fff; border-radius: var(--r-lg); padding: 14px 20px; border-bottom: 5px solid var(--gold); box-shadow: var(--sh); }
.board-logo { width: 100%; }
.board-title h1 { margin: 0; font-size: clamp(1.2rem, 2.4vw, 2rem); }
.board-title p { margin: 0; color: var(--ink-3); font-weight: 600; }
.board-counter { display: flex; flex-direction: column; align-items: center; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: 18px; padding: 10px 26px; }
.board-counter span { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 800; line-height: 1.1; }
.board-counter small { color: var(--gold); font-weight: 800; }
.board-cats { justify-content: center; margin: 16px 0; }
.board-cats .cat-pill { font-size: 1rem; padding: 6px 16px; }
.board-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.board-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }

/* نسب الأشرطة (بدون style مضمّن: سياسة الأمان CSP) */
.w-0{width:0}.w-5{width:5%}.w-10{width:10%}.w-15{width:15%}.w-20{width:20%}.w-25{width:25%}.w-30{width:30%}.w-35{width:35%}.w-40{width:40%}.w-45{width:45%}.w-50{width:50%}.w-55{width:55%}.w-60{width:60%}.w-65{width:65%}.w-70{width:70%}.w-75{width:75%}.w-80{width:80%}.w-85{width:85%}.w-90{width:90%}.w-95{width:95%}.w-100{width:100%}
.bar i.w-0,.bar i.w-5,.bar i.w-10,.bar i.w-15,.bar i.w-20,.bar i.w-25,.bar i.w-30,.bar i.w-35,.bar i.w-40,.bar i.w-45,.bar i.w-50,.bar i.w-55,.bar i.w-60,.bar i.w-65,.bar i.w-70,.bar i.w-75,.bar i.w-80,.bar i.w-85,.bar i.w-90,.bar i.w-95,.bar i.w-100{min-width:0}

/* ══════════ التجاوب ══════════ */
@media (max-width: 1100px) {
  .scan-layout { grid-template-columns: 1fr; }
  .live-panel { position: static; max-height: 70vh; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .users-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; position: absolute; top: 100%; inset-inline: 0; flex-direction: column; align-items: stretch; background: var(--navy); padding: 8px 12px 14px; border-bottom: 3px solid var(--gold); box-shadow: var(--sh-lg); }
  .mainnav.is-open { display: flex; }
  .mainnav a, .nav-logout button { padding: 12px; width: 100%; }
  .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .topbar-in { position: relative; }
  .board-head { grid-template-columns: 1fr auto; }
  .board-logo { grid-column: 1 / -1; max-width: 420px; margin: 0 auto; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hero-features { grid-template-columns: 1fr; }
  .hero-features div { flex-direction: row; text-align: start; padding: 12px 14px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .cat-pick { grid-template-columns: 1fr 1fr; }
  .alt-inputs { grid-template-columns: 1fr; }
  .camera { aspect-ratio: 3 / 4; max-height: 62vh; }
  .counter-n { font-size: 2.5rem; }
  .table-tools .search { flex: 1 1 100%; min-width: 0; }
  .table-tools select { flex: 1 1 0; min-width: 0; padding-inline: 8px; font-size: .85rem; }
  .table-tools [data-filter-count] { flex: 1 1 100%; }
  /* الجدول يصبح بطاقات */
  .ptable:not(.preview) thead { display: none; }
  .ptable:not(.preview), .ptable:not(.preview) tbody, .ptable:not(.preview) tr, .ptable:not(.preview) td { display: block; width: 100%; }
  .ptable:not(.preview) tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .ptable:not(.preview) td { padding: 2px 0; border: 0; }
  .ptable:not(.preview) td.c-act { position: absolute; top: 8px; inset-inline-end: 8px; width: auto; }
  .ptable:not(.preview) td.c-name { padding-inline-end: 40px; }
  .ptable:not(.preview) td.c-inv, .ptable:not(.preview) td.c-att { display: inline-block; width: auto; margin-inline-end: 10px; }
  .page-head { align-items: stretch; }
  .head-actions .btn { flex: 1; }
  .sheet { align-items: end; padding: 0; }
  .sheet-card { border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media print {
  .topbar, .head-actions, .send-box, .table-tools, .c-act, .flashes { display: none !important; }
  .card { border: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
