/* ===================== الخطوط ===================== */
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../fonts/tajawal-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../fonts/tajawal-arabic-500-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Tajawal'; font-weight: 800; font-display: swap; src: url('../fonts/tajawal-arabic-800-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('../fonts/tajawal-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('../fonts/tajawal-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Tajawal'; font-weight: 800; font-display: swap; src: url('../fonts/tajawal-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }

/* ===================== هوية «نداء»: برغندي + بيج ===================== */
:root {
  --bg: #f5eee3; --bg2: #efe5d5; --card: #fffcf7; --ink: #2a1418; --muted: #7d6a63; --line: #e8dccb; --line2: #f1e8da;
  --brand: #7a1626; --brand-d: #5a0c1a; --brand-dd: #3d0711; --brand-2: #962637; --brand-soft: #f6e4e3; --brand-ring: rgba(122,22,38,.16);
  --gold: #c39a6b; --gold-d: #a37a4b; --gold-soft: #f4e8d6; --cream: #f7efe2;
  --em: #1f9d6b; --em-d: #157a52; --em-soft: #e3f4ea;
  --amber: #c98a1b; --amber-soft: #fbefd6; --red: #c93838; --red-soft: #fbe7e5; --taupe: #8a6f60; --taupe-soft: #efe6dc;
  --r: 16px; --shadow: 0 1px 2px rgba(61,7,17,.05), 0 8px 26px rgba(61,7,17,.07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Tajawal', system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(122,22,38,.18); }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: right; }
.pad { padding: 16px 20px; }
.inline { display: inline; }
strong, b { font-weight: 800; }

/* ===================== الأزرار والحقول ===================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: #fffdf9; font-weight: 700; cursor: pointer; transition: .15s; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: #d8c6ad; background: var(--cream); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(122,22,38,.25); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand), var(--brand-d)); color: #fff; border-color: transparent; }
.btn-amber { background: linear-gradient(135deg, #d6ae7f, var(--gold)); border-color: transparent; color: #3d2410; }
.btn-amber:hover { background: var(--gold-d); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: #fffdf9; cursor: pointer; color: #6d5650; transition: .15s; }
.icon-btn:hover { background: var(--cream); color: var(--brand); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); border-color: #f0c3bf; }
.icon-btn.xs { width: 28px; height: 28px; border-radius: 8px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.form input:not([type=checkbox]):not([type=file]), .form select, .filters select, .filters input, .search input {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #ddcdb6; background: #fffdf9; outline: none; width: 100%; transition: .15s; font-weight: 500;
}
.form input:focus, .form select:focus, .filters select:focus, .search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.form input[type=file] { padding: 10px; border: 1px dashed #d3bfa3; border-radius: 12px; background: var(--cream); }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form .check input { accent-color: var(--brand); width: 18px; height: 18px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 700; font-size: 14px; }
.alert-error { background: var(--red-soft); color: #9e1f1f; border: 1px solid #f1c6c1; }
.alert-success { background: var(--em-soft); color: #136b47; border: 1px solid #bfe3cf; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.p-new { background: var(--em-soft); color: var(--em-d); }
.p-called { background: var(--amber-soft); color: #94600c; }
.p-done { background: var(--taupe-soft); color: var(--taupe); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ===================== التخطيط (الإدارة) ===================== */
body.admin { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex: none; background: linear-gradient(180deg, var(--brand-d), var(--brand-dd)); color: #f0e2d4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; z-index: 30; }
.sidebar::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(260px 200px at 80% 0%, rgba(195,154,107,.22), transparent 70%); }
.brand { position: relative; display: flex; align-items: center; gap: 12px; padding: 2px 6px 18px; border-bottom: 1px solid rgba(247,239,226,.12); margin-bottom: 14px; }
.brand-logo { width: 58px; height: 58px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.brand > div { min-width: 0; }
.brand strong { display: block; color: #fff; font-size: 15.5px; white-space: nowrap; }
.brand small { color: #d9bf9c; font-size: 12.5px; }
.sidebar nav { position: relative; display: grid; gap: 4px; flex: 1; align-content: start; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: #ead8c8; font-weight: 700; font-size: 14.5px; transition: .15s; }
.sidebar nav a:hover { background: rgba(247,239,226,.08); color: #fff; }
.sidebar nav a.active { background: var(--cream); color: var(--brand-d); box-shadow: inset -4px 0 0 var(--gold); }
.sidebar .badge { margin-right: auto; background: var(--gold); color: var(--brand-dd); font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.sidebar nav a.active .badge { background: var(--brand); color: #fff; }
.logout { position: relative; }
.logout button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; border: 1px solid rgba(247,239,226,.14); background: rgba(247,239,226,.06); color: #f3d9c6; font-weight: 700; cursor: pointer; }
.logout button:hover { background: rgba(247,239,226,.14); color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(255,252,247,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 20px; font-weight: 800; flex: 1; color: var(--brand-d); }
.who { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 700; font-size: 14px; background: var(--brand-soft); padding: 7px 12px; border-radius: 99px; }
.menu-btn { display: none; }
.content { padding: 24px 28px 40px; display: grid; gap: 20px; align-content: start; }
.overlay { display: none; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line2); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 16.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; color: var(--brand-d); }
.card-head h2 .ic { color: var(--gold-d); }
.card.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; min-width: 210px; }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; right: 12px; color: #a8927f; }
.search input { padding-right: 38px; min-width: 260px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: var(--card); border-radius: var(--r); padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); border: 1px solid var(--line2); position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .6; }
.stat b { font-size: 28px; line-height: 1; display: block; color: var(--brand-d); }
.stat small { color: var(--muted); font-weight: 500; }
.stat-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-ic.blue { background: var(--brand-soft); color: var(--brand); }
.stat-ic.green { background: var(--em-soft); color: var(--em-d); }
.stat-ic.amber { background: var(--gold-soft); color: var(--gold-d); }
.stat-ic.violet { background: var(--taupe-soft); color: var(--taupe); }
.stat-ic.red { background: var(--red-soft); color: var(--red); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; font-weight: 800; color: var(--brand-d); background: var(--gold-soft); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdf7ef; }
.row-actions { white-space: nowrap; text-align: left; }
.row-actions > * { margin-inline-start: 4px; }
.pager { display: flex; gap: 6px; padding: 14px 20px; flex-wrap: wrap; }
.pager a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); font-weight: 700; background: #fffdf9; }
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.hint-card { padding: 20px 24px; border-right: 4px solid var(--gold); }
.hint-card ol { padding-right: 20px; margin-top: 8px; display: grid; gap: 6px; }
.error-list { padding: 0 40px 18px 20px; color: #9e1f1f; font-size: 14px; display: grid; gap: 4px; }

/* المواقف (خرائط مصغرة) — ألوان الحالة ثابتة: أخضر متاح، أحمر مشغول، رمادي موقوف */
.spot-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; padding: 18px 20px 10px; }
.spot { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; align-content: center; font-weight: 800; font-size: 15px; border: 2px solid; position: relative; text-align: center; padding: 2px; }
.spot small { font-size: 10.5px; font-weight: 700; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-free { background: var(--em-soft); border-color: #a9dcc0; color: var(--em-d); }
.s-busy { background: var(--red-soft); border-color: #eeb3ad; color: #b02a2a; }
.s-called { background: var(--amber-soft); border-color: #eccb8c; color: #94600c; }
.s-off { background: #eee8df; border-color: #ddd3c5; color: #a2968a; }
.s-mine { background: var(--brand); border-color: var(--brand-d); color: #fff; }
.spot-rows { display: grid; gap: 8px; padding: 18px 20px 14px; }
.spot-row { display: flex; justify-content: center; gap: 8px; }
.spot-row .spot { width: calc((100% - 96px) / 13); aspect-ratio: auto; min-height: 50px; }
#spotMap .spot-row .spot { min-height: 58px; }
.inline-legend { padding: 0; }
.legend-row { display: flex; gap: 16px; padding: 4px 20px 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend-row span { display: flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 4px; border: 2px solid; }
.lg.free { background: var(--em-soft); border-color: #a9dcc0; }
.lg.busy { background: var(--red-soft); border-color: #eeb3ad; }
.lg.called { background: var(--amber-soft); border-color: #eccb8c; }
.lg.off { background: #eee8df; border-color: #ddd3c5; }
.spot-num { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.spot-num.s-new { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(122,22,38,.3); }
.spot-num.s-called { background: var(--gold); color: #3d2410; }
.spot-num.s-done { background: #e6ddd1; color: #8a7a6d; }
.feed-mini { list-style: none; }
.feed-mini li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line2); }
.feed-mini li:last-child { border-bottom: 0; }
.feed-mini li > div { flex: 1; min-width: 0; }
.feed-mini strong { display: block; }
.feed-mini small { color: var(--muted); font-size: 12.5px; }
.feed-mini time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* الهيكل الدراسي */
.grades { display: grid; gap: 12px; padding: 16px 20px; }
.grade { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fdf8f1; }
.grade-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.grade-head strong { color: var(--brand-d); }
.class-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip-class { display: flex; align-items: center; gap: 4px; background: #fffdf9; border: 1px solid var(--line); border-radius: 12px; padding: 5px 6px; }
.chip-class a { display: grid; padding: 0 8px; color: var(--ink); line-height: 1.3; }
.chip-class a:hover b { color: var(--brand); }
.chip-class a small { color: var(--muted); font-size: 11.5px; }

/* نوافذ */
.dialog { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(61,7,17,.35); margin: auto; background: var(--card); color: var(--ink); }
.dialog::backdrop { background: rgba(40,6,14,.5); backdrop-filter: blur(3px); }
.dialog .form { padding: 20px 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.dialog-head h3 { font-size: 18px; font-weight: 800; color: var(--brand-d); }
.dialog-foot { display: flex; gap: 8px; margin-top: 4px; }

/* إدارة المواقف */
.spot-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; padding: 18px 20px; }
.spot-card { border: 2px solid; border-radius: 14px; padding: 12px; display: grid; gap: 6px; justify-items: center; }
.spot-card b { font-size: 26px; line-height: 1; }
.spot-card small { font-weight: 700; }

/* خانة الانصراف */
.counters { display: flex; gap: 10px; }
.counter { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line2); box-shadow: var(--shadow); font-weight: 700; color: var(--muted); }
.counter b { font-size: 24px; line-height: 1; }
.c-new b { color: var(--brand); } .c-called b { color: var(--gold-d); } .c-done b { color: var(--taupe); }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--brand); font-size: 13px; background: var(--brand-soft); padding: 6px 12px; border-radius: 99px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(122,22,38,.55); } 70% { box-shadow: 0 0 0 8px rgba(122,22,38,0); } 100% { box-shadow: 0 0 0 0 rgba(122,22,38,0); } }
.seg { display: inline-flex; background: var(--bg2); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fffdf9; color: var(--brand); box-shadow: 0 1px 3px rgba(61,7,17,.12); }
.dismissal { display: grid; gap: 20px; }
.dismissal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.feed td { font-size: 14.5px; white-space: nowrap; }
.feed .row-new td { background: #fdf3ef; }
.feed .row-done td { color: #8a7a6d; }
.feed tr.flash td { animation: flash 1.6s ease 2; }
@keyframes flash { 50% { background: #f4d9d3; } }
.feed a { color: var(--ink); font-weight: 700; }

/* ===================== صفحة الدخول: صورة المدرسة خلفية ===================== */
body.auth { min-height: 100vh; position: relative; isolation: isolate; color: #fff; background: var(--brand-dd); }
body.auth::before { content: ''; position: fixed; inset: 0; z-index: -2; background: url('../img/school.jpg') center 35% / cover no-repeat; }
body.auth::after { content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(270deg, rgba(61,7,17,.88) 0%, rgba(90,12,26,.62) 38%, rgba(90,12,26,.28) 62%, rgba(40,6,14,.55) 100%),
    linear-gradient(180deg, rgba(40,6,14,.15) 0%, rgba(40,6,14,.55) 100%); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 64px; padding: 32px 20px; flex-wrap: wrap; }
.auth-hero { max-width: 470px; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.hero-logo { width: 150px; height: 150px; object-fit: contain; display: block; filter: drop-shadow(0 10px 24px rgba(0,0,0,.35)); }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; font-weight: 700; color: #f6e3c8; background: rgba(195,154,107,.18); border: 1px solid rgba(214,174,127,.5); padding: 6px 14px; border-radius: 99px; backdrop-filter: blur(6px); }
.hero-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.auth-hero h1 { font-size: 40px; line-height: 1.3; font-weight: 800; margin: 14px 0 10px; color: #fff; }
.auth-hero p { color: #f1e2d2; font-size: 17px; }
.hero-line { width: 120px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--gold), transparent); margin-top: 18px; }
.auth-card { width: min(420px, 100%); background: rgba(255,251,245,.95); color: var(--ink); border-radius: 24px; padding: 26px 28px 30px; box-shadow: 0 30px 80px rgba(20,3,7,.45); border: 1px solid rgba(214,174,127,.45); backdrop-filter: blur(10px); text-shadow: none; }
.auth-card h2 { font-size: 24px; font-weight: 800; text-align: center; color: var(--brand-d); }
.auth-card > p.muted { text-align: center; margin-bottom: 18px; }
.auth-logo { width: 104px; height: 104px; margin: 0 auto 6px; display: block; object-fit: contain; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); padding: 5px; border-radius: 14px; margin-bottom: 18px; border: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 10px; border-radius: 11px; font-weight: 800; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(122,22,38,.25); }
.tab-panel { display: none; }
.tab-panel.active { display: grid; }

/* ===================== صفحة ولي الأمر ===================== */
body.parent { min-height: 100vh; color: var(--ink); background: radial-gradient(600px 380px at 50% -60px, rgba(195,154,107,.28), transparent 70%), var(--bg); }
.p-app { max-width: 560px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); padding: max(12px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.p-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 20px; background: linear-gradient(135deg, var(--brand), var(--brand-d)); color: #fff; box-shadow: 0 10px 26px rgba(90,12,26,.28); }
.p-brand { display: flex; align-items: center; gap: 10px; }
.p-brand img { width: 50px; height: 50px; object-fit: contain; flex: none; }
.p-brand strong { display: block; font-size: 17px; color: #fff; }
.p-brand > div { min-width: 0; }
.p-brand strong, .p-brand small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-brand small { display: block; color: #e8cfae; font-size: 12.5px; }
.p-icon { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(247,239,226,.25); background: rgba(247,239,226,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.p-icon:hover { background: rgba(247,239,226,.22); }
.p-students { display: grid; gap: 8px; }
.p-hint { color: var(--muted); font-size: 13.5px; font-weight: 700; }
.p-student { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: default; }
label.p-student { cursor: pointer; }
.p-student.on { border-color: rgba(122,22,38,.35); box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow); }
.p-student input { width: 20px; height: 20px; accent-color: var(--brand); }
.p-student .avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--brand); flex: none; }
.p-student > div:not(.avatar) { flex: 1; min-width: 0; }
.p-student strong, .p-student small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-student strong { display: block; font-size: 16px; color: var(--brand-d); }
.p-student small { color: var(--muted); font-size: 13px; }
.p-student .tag { font-size: 11.5px; flex: none; font-weight: 800; color: var(--em-d); background: var(--em-soft); padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.tag.t-new { color: var(--brand); background: var(--brand-soft); }
.tag.t-called { color: #94600c; background: var(--amber-soft); }
.tag.t-done { color: var(--taupe); background: var(--taupe-soft); }
.p-step h2 { font-size: 19px; font-weight: 800; color: var(--brand-d); }
.p-step p { color: var(--muted); font-size: 14px; }
.p-viewer { position: relative; }
.p-canvas { height: clamp(360px, 62vh, 600px); border-radius: 22px; overflow: hidden; background: linear-gradient(180deg, #e9dfcf, #d9cbb4); border: 1px solid var(--line); box-shadow: var(--shadow); touch-action: none; position: relative; }
.p-canvas canvas { display: block; position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.p-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand); font-weight: 700; text-align: center; padding: 20px; }
.p-toggle { position: absolute; top: 10px; left: 10px; display: flex; background: rgba(255,251,245,.88); border: 1px solid var(--line); border-radius: 12px; padding: 3px; backdrop-filter: blur(8px); z-index: 2; box-shadow: 0 4px 12px rgba(61,7,17,.12); }
.p-toggle button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 9px; font-weight: 800; font-size: 13px; cursor: pointer; }
.p-toggle button.active { background: var(--brand); color: #fff; }
.p-grid { border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 52px 12px 14px; display: grid; gap: 8px; }
.p-grid-cap { font-size: 12.5px; font-weight: 800; color: var(--brand-d); margin-top: 4px; text-align: center; }
.p-lot { display: grid; grid-template-columns: 1fr 54px 1fr; gap: 8px; }
.p-lot-col { display: grid; gap: 5px; align-content: start; }
.p-lot-aisle { border-radius: 12px; background: repeating-linear-gradient(180deg, #3d3f45 0 18px, #c9a14f 18px 26px, #3d3f45 26px 44px); background-size: 6px 100%; background-repeat: repeat-y; background-position: center; background-color: #45474d; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 11px; font-weight: 800; color: #f1e7d8; }
.p-lot-aisle i { font-style: normal; font-size: 22px; color: #fff; opacity: .85; }
.p-lot-col button { height: 34px; border-radius: 10px; border: 2px solid #8fd1ad; background: var(--em-soft); color: var(--em-d); font-weight: 800; font-size: 16px; cursor: pointer; }
.p-lot-col button.g-busy { border-color: #eeb3ad; background: var(--red-soft); color: #b02a2a; cursor: not-allowed; }
.p-lot-col button.g-off { border-color: #ddd3c5; background: #eee8df; color: #a2968a; cursor: not-allowed; }
.p-lot-col button.g-mine, .p-lot-col button.g-sel { background: #22c77d; border-color: #18a866; color: #fff; box-shadow: 0 0 0 3px rgba(34,199,125,.25); }
.p-legend { display: flex; justify-content: center; gap: 14px; font-size: 13px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.p-legend span { display: flex; align-items: center; gap: 6px; }
.p-legend i { width: 12px; height: 12px; border-radius: 4px; }
.p-legend .free { background: var(--em-soft); border: 1.5px solid #3fae7a; }
.p-legend .busy { background: var(--red-soft); border: 1.5px solid var(--red); }
.p-legend .sel { background: #22c77d; }
.p-legend .off { background: #eee8df; border: 1.5px solid #b7aa9b; }
.p-selected { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.p-selected .num { width: 58px; height: 58px; border-radius: 16px; background: var(--bg2); color: #b3a291; font-size: 30px; font-weight: 800; display: grid; place-items: center; flex: none; transition: .2s; }
.p-selected.on .num { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 8px 20px rgba(122,22,38,.3); }
.p-selected small { color: var(--muted); font-size: 13px; display: block; }
.p-selected strong { font-size: 16px; color: var(--brand-d); }
.p-send { height: 60px; border-radius: 18px; border: 0; background: linear-gradient(135deg, var(--brand-2), var(--brand-d)); color: #fff; font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 12px 30px rgba(122,22,38,.32); cursor: pointer; width: 100%; transition: .15s; }
.p-send:hover { filter: brightness(1.06); }
.p-send:disabled { background: var(--bg2); color: #b3a291; box-shadow: none; cursor: not-allowed; filter: none; }
.p-link { background: none; border: 0; color: var(--brand); font-weight: 700; cursor: pointer; padding: 6px; }
.p-status { border-radius: 24px; padding: 26px 20px 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden; }
.p-status::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--brand), var(--gold)); }
#statusView[data-status=called] .p-status::before { background: linear-gradient(90deg, var(--gold), var(--amber)); }
.p-status-spot { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 30px; background: linear-gradient(135deg, var(--brand-2), var(--brand-d)); color: #fff; display: grid; place-items: center; align-content: center; box-shadow: 0 14px 34px rgba(122,22,38,.35); }
#statusView[data-status=called] .p-status-spot { background: linear-gradient(135deg, #d9b07f, var(--gold-d)); color: #3d2410; box-shadow: 0 14px 34px rgba(163,122,75,.4); }
#statusView[data-status=done] .p-status-spot { background: #e6ddd1; color: #7d6a63; box-shadow: none; }
.p-status-spot small { font-weight: 800; font-size: 14px; }
.p-status-spot b { font-size: 54px; line-height: 1; }
.p-status h2 { font-size: 22px; font-weight: 800; color: var(--brand-d); }
.p-status > p { color: var(--muted); margin-top: 4px; }
.p-steps { list-style: none; text-align: right; margin: 20px auto 6px; max-width: 340px; display: grid; gap: 0; }
.p-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; position: relative; color: #b3a291; font-weight: 700; }
.p-steps li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #d8c9b4; flex: none; position: relative; z-index: 1; background: var(--card); }
.p-steps li:not(:last-child)::after { content: ''; position: absolute; right: 10px; top: 32px; bottom: -10px; width: 2px; background: #e4d7c4; }
.p-steps li.done { color: var(--ink); }
.p-steps li.done i { background: var(--brand); border-color: var(--brand); }
.p-steps li.done:not(:last-child)::after { background: var(--brand); opacity: .35; }
.p-steps li.now i { box-shadow: 0 0 0 5px var(--brand-ring); }
.p-steps li time { margin-right: auto; font-size: 13px; color: var(--muted); }
.p-status-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.p-btn { height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: #fffdf9; color: var(--brand-d); font-weight: 800; cursor: pointer; }
.p-btn:hover { background: var(--cream); }
.p-btn.danger { color: var(--red); border-color: #efc3be; }
.p-back { margin-top: 16px; width: 100%; height: 52px; border-radius: 16px; border: 1px solid rgba(122,22,38,.3); background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.p-back:hover { background: #f1d6d4; }
.p-toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 140%); background: var(--brand-dd); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 12px 30px rgba(40,6,14,.4); transition: .3s; max-width: calc(100vw - 32px); z-index: 50; text-align: center; visibility: hidden; }
.p-toast.show { transform: translate(-50%, 0); visibility: visible; }
.p-toast.ok { background: var(--brand); }
.p-toast.warn { background: #8a4b12; }

/* ===================== الاستجابة ===================== */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dismissal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; right: 0; transform: translateX(105%); transition: transform .25s; box-shadow: -20px 0 50px rgba(40,6,14,.35); }
  .sidebar.open { transform: none; }
  .overlay.show { display: block; position: fixed; inset: 0; background: rgba(40,6,14,.45); z-index: 25; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .search input { min-width: 0; }
  .filters, .filters select, .search { width: 100%; }
  .who span { display: none; }
  .auth-wrap { gap: 28px; }
}
@media (max-width: 760px) {
  body.auth::after { background: linear-gradient(180deg, rgba(61,7,17,.55) 0%, rgba(61,7,17,.72) 55%, rgba(40,6,14,.88) 100%); }
  .auth-hero { text-align: center; max-width: 100%; }
  .auth-hero .hero-logo { margin: 0 auto; width: 110px; height: 110px; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero p, .hero-line { display: none; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat b { font-size: 22px; }
  .stat-ic { width: 40px; height: 40px; }
  .row-2 { grid-template-columns: 1fr; }
  .spot-grid { grid-template-columns: repeat(5, 1fr); }
  .counters { width: 100%; }
  .counter { flex: 1; padding: 10px; justify-content: center; }
  .auth-wrap { padding: 20px 16px; align-content: center; }
  .auth-hero h1 { display: none; }
  .auth-card { padding: 22px 20px 24px; }
  .auth-logo { display: none; }
  .p-lot-col button { font-size: 14px; }
}

/* بطاقة الموقف المحدد فوق المشهد ثلاثي الأبعاد */
.pk-label { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px; background: rgba(30, 10, 14, .86); border: 1.5px solid #3dff9e; box-shadow: 0 0 22px rgba(61, 255, 158, .4), 0 10px 24px rgba(0, 0, 0, .35); color: #fff; white-space: nowrap; backdrop-filter: blur(6px); will-change: transform; }
.pk-label .pk-ic { width: 34px; height: 34px; border-radius: 50%; background: rgba(61, 255, 158, .16); color: #3dff9e; display: grid; place-items: center; flex: none; }
.pk-label small { display: block; font-size: 11.5px; color: #e3cfbd; font-weight: 700; line-height: 1.2; }
.pk-label b { display: block; font-size: 22px; line-height: 1.05; font-weight: 800; }
.pk-label::after { content: ''; position: absolute; left: 16%; bottom: -7px; width: 12px; height: 12px; background: rgba(30, 10, 14, .86); border-right: 1.5px solid #3dff9e; border-bottom: 1.5px solid #3dff9e; transform: translateX(-50%) rotate(45deg); }
.pk-label[data-side='l']::after { left: 84%; }
@media (max-width: 560px) {
  .pk-label { padding: 6px 10px 6px 8px; gap: 8px; border-radius: 12px; }
  .pk-label .pk-ic { width: 28px; height: 28px; }
  .pk-label b { font-size: 18px; }
  .pk-label small { font-size: 10.5px; }
}
