/* استمارة حصر المدارس — نفس لغة تصميم المستشارية (كحلي + ذهبي) */
:root {
  --sn: #0c1e30; --sn2: #122840; --sn3: #1a3354;
  --sg: #d4a017; --sg2: #e8b830;
  --ink: #08131f;
  --bg: #f2efe9;
  --text: #1a1410; --text-2: #3d3730; --text-3: #6c757d; --text-4: #9c9488;
  --border: #e2ddd6;
  --success: #0a7c52; --success-bg: #f0faf5;
  --error: #b91c1c; --error-bg: #fef2f2;
  --warning: #b45309; --warning-bg: #fffbeb;
  --radius: 12px;
}
* { box-sizing: border-box; }
.me-1 { margin-inline-end: .25rem; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
.bi { line-height: 1; }
.c-loading {
  position: fixed; inset: 0; background: rgba(8,19,31,.82); backdrop-filter: blur(6px);
  z-index: 9999; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.c-loading.show { display: flex; }
.c-spinner {
  width: 48px; height: 48px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--sg2);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.c-loading-text { color: rgba(255,255,255,.7); font-size: 14px; font-weight: 500; }
.c-header {
  background: var(--ink); padding: 14px clamp(16px,4vw,48px);
  display: flex; justify-content: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 4px 20px rgba(0,0,0,.35);
  position: sticky; top: 0; z-index: 100;
}
.c-header-center { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.c-header-logo { height: 60px; width: auto; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.c-header-main { color: rgba(255,255,255,.95); font-size: clamp(13px,2.2vw,17px); font-weight: 800; line-height: 1.3; }
.c-header-sub { color: var(--sg2); font-size: clamp(11px,1.6vw,13px); font-weight: 600; }
.c-hero {
  background: linear-gradient(160deg, var(--sn) 0%, var(--ink) 100%);
  padding: clamp(36px,7vw,64px) 20px clamp(48px,9vw,80px);
  position: relative; overflow: hidden; text-align: center;
}
.c-hero-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(212,160,23,.1); pointer-events: none; }
.c-hero-ring-1 { width: 420px; height: 420px; top: -180px; left: -100px; }
.c-hero-ring-2 { width: 260px; height: 260px; top: 20px; right: -60px; border-color: rgba(255,255,255,.05); }
.c-hero-ring-3 { width: 150px; height: 150px; bottom: 0; left: 20%; border-color: rgba(212,160,23,.08); }
.c-hero::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 40px;
  background: var(--bg); clip-path: ellipse(60% 100% at 50% 100%);
}
.c-hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.c-hero h1 { color: #fff; font-size: clamp(22px,4.2vw,34px); font-weight: 900; line-height: 1.35; margin-bottom: 12px; }
.c-hero h1 em { font-style: normal; color: var(--sg2); }
.c-hero-desc { color: rgba(255,255,255,.6); font-size: clamp(13px,2vw,15px); max-width: 640px; margin: 0 auto; line-height: 1.85; }
.reg-section { padding: 0 0 4rem; flex: 1; }
.reg-wrap { max-width: 940px; margin: -30px auto 0; padding: 0 16px; position: relative; z-index: 2; }
.reg-container {
  background: #fff; border-radius: 20px;
  box-shadow: 0 14px 48px rgba(8,19,31,.16), 0 4px 14px rgba(8,19,31,.08);
  padding: 2rem; min-width: 0; max-width: 100%;
}
@media (max-width: 576px) { .reg-container { padding: 1.25rem 1rem; border-radius: 16px; } }
.notice-box { text-align: center; padding: 1.5rem 0; }
.notice-box h2 { color: var(--sn); font-size: 1.3rem; font-weight: 800; margin-bottom: .75rem; }
.notice-box p { color: var(--text-3); line-height: 1.7; }
.notice-box .notice { color: var(--error); font-weight: 700; }
.notice-box code { background: #f1f1f1; padding: 2px 8px; border-radius: 4px; font-size: .85em; }
.intro-box {
  background: rgba(12,30,48,.045); border: 1px solid rgba(12,30,48,.1);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.75rem;
  font-size: .93rem; color: var(--text-2); line-height: 1.85;
}
.intro-box strong { color: var(--sn); }
.form-section { margin-bottom: 2.1rem; padding-bottom: 1.6rem; border-bottom: 1px solid #f0eee9; scroll-margin-top: 130px; }
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.3rem; }
.form-section-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--sn); color: var(--sg2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; flex-shrink: 0;
}
.form-section-head h3 { color: var(--sn); font-size: 1.08rem; font-weight: 800; }
.f-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.f-col { flex: 1 1 100%; min-width: 0; }
.f-col-6 { flex: 1 1 calc(50% - .5rem); min-width: 0; }
@media (max-width: 640px) { .f-col-6 { flex: 1 1 100%; } }
.form-label { display: block; font-weight: 700; color: var(--text-2); font-size: .92rem; margin-bottom: .45rem; }
.req-star { color: var(--error); }
.form-text { font-size: .8rem; color: var(--text-4); margin-top: .35rem; line-height: 1.55; }
.form-control, .form-select, textarea.form-control {
  width: 100%; background: #fbfaf8; border: 1.5px solid var(--border); border-radius: 9px;
  padding: .65rem .9rem; font-family: inherit; font-size: .95rem; color: var(--text); outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.form-control:focus, .form-select:focus { border-color: var(--sn); background: #fff; box-shadow: 0 0 0 4px rgba(12,30,48,.09); }
.form-control.is-invalid { border-color: var(--error); }
textarea.form-control { resize: vertical; min-height: 110px; }
.ltr-field { direction: ltr; text-align: left; }
.field-err { display: none; font-size: .8rem; color: var(--error); margin-top: .4rem; align-items: center; gap: .35rem; }
.field-err.show { display: flex; }
.swal-val-list { list-style: none; padding: 0; margin: .5rem 0 0; text-align: right; }
.swal-val-list li { padding: .45rem 0; border-bottom: 1px solid #ece8e0; font-size: .92rem; color: #3d3730; }
.swal-val-list li:last-child { border-bottom: none; }
.radio-card-group, .check-grid { display: flex; gap: .65rem; flex-wrap: wrap; }
.radio-card-group-vertical { flex-direction: column; }
.radio-card, .check-card {
  flex: 1; min-width: 180px; border: 1.5px solid var(--border); border-radius: 10px;
  padding: .8rem 1.05rem; cursor: pointer; display: flex; align-items: center; gap: .65rem;
  transition: all .18s; user-select: none; background: #fbfaf8; position: relative;
}
.radio-card-group-vertical .radio-card { min-width: 100%; flex: none; }
.check-card { flex: 1 1 calc(50% - .5rem); }
@media (max-width: 640px) { .check-card { flex: 1 1 100%; } }
.radio-card:hover, .check-card:hover { border-color: #c9c2b5; background: #fff; }
.radio-card.sel, .check-card.sel { border-color: var(--sn); background: rgba(12,30,48,.045); box-shadow: 0 0 0 3px rgba(12,30,48,.08); }
.radio-pip, .check-pip { width: 18px; height: 18px; border: 2px solid #ccc4b6; flex-shrink: 0; transition: all .18s; }
.radio-pip { border-radius: 50%; }
.check-pip { border-radius: 5px; }
.radio-card.sel .radio-pip { border-color: var(--sn); border-width: 5px; }
.check-card.sel .check-pip { border-color: var(--sn); background: var(--sn); box-shadow: inset 0 0 0 3px #fff; }
.radio-lbl, .check-lbl { font-size: .9rem; font-weight: 700; color: var(--text-2); line-height: 1.4; }
.check-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.cond-field { display: none; }
.cond-field.show { display: block; }
.verify-upload-box {
  border: 1.5px dashed #cfc9bd; border-radius: var(--radius); padding: 1.1rem 1.2rem; background: #fcfbf9;
}
.verify-upload-head { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .8rem; }
.verify-upload-head i { font-size: 1.5rem; color: var(--sg); margin-top: 2px; }
.verify-upload-head strong { color: var(--text-2); font-size: .95rem; }
.verify-upload-head p { margin: .3rem 0 0; font-size: .8rem; color: var(--text-3); line-height: 1.55; }
.file-picker-row { display: flex; align-items: center; gap: .65rem; min-width: 0; position: relative; }
.file-picker-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem;
  background: var(--sn); color: #fff; border-radius: 8px; padding: .55rem .9rem;
  font-size: .85rem; font-weight: 700; cursor: pointer;
}
.file-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; color: var(--text-3); }
.file-picker-name.selected { color: var(--text-2); font-weight: 600; }
.file-picker-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-list { margin: .7rem 0 0; padding: 0 1.1rem 0 0; color: var(--text-2); font-size: .84rem; }
.file-list li { margin: .2rem 0; }
.skip-note {
  background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(180,83,9,.16);
  border-radius: 10px; padding: .85rem 1rem; font-size: .88rem; font-weight: 700;
}
.split-ltr-input-group { display: flex; direction: ltr; align-items: stretch; }
.split-ltr-input-group .split-lead {
  border: 1.5px solid var(--border); background: #f3f1ec; display: flex; align-items: center; justify-content: center;
  border-radius: 9px 0 0 9px; margin-right: -1px; min-width: 58px; padding: .65rem .75rem;
  font-family: ui-monospace, 'Courier New', monospace; font-weight: 700; color: var(--sn);
}
.split-ltr-input-group .split-trail {
  border-radius: 0 9px 9px 0; flex: 1; min-width: 0;
  font-family: ui-monospace, 'Courier New', monospace; letter-spacing: .03em;
}
.btn-census {
  background: var(--sn); border: none; color: #fff; padding: .85rem 2.4rem; border-radius: 9px;
  font-weight: 700; font-size: 1rem; font-family: inherit; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.btn-census:hover { background: var(--sn2); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(8,19,31,.3); }
.btn-census:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
@media (min-width: 560px) { .btn-census { width: auto; } }
.form-actions { display: flex; justify-content: flex-end; margin-top: 1.75rem; }
.form-back {
  display: inline-flex; align-items: center; margin-bottom: 14px; color: var(--sg2);
  font-weight: 700; text-decoration: none; font-size: .92rem;
}
.form-back:hover { color: #fff; }
.choice-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .45rem;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 1.4rem 1.35rem 1.2rem;
  text-decoration: none; color: inherit; box-shadow: 0 10px 30px rgba(8,19,31,.06);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.choice-card:hover { transform: translateY(-2px); border-color: var(--sg); box-shadow: 0 16px 34px rgba(8,19,31,.1); }
.choice-icon {
  width: 64px; height: 64px; border-radius: 18px; margin-bottom: .35rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(212,160,23,.14); color: var(--sn); font-size: 1.8rem;
}
.choice-kicker { color: var(--sg); font-weight: 800; font-size: .82rem; }
.choice-card h2 { color: var(--sn); font-size: 1.35rem; font-weight: 900; }
.choice-go { margin-top: .6rem; color: var(--sn); font-weight: 800; }
.c-footer {
  background: linear-gradient(180deg, var(--sn2) 0%, var(--ink) 100%);
  border-top: 2px solid var(--sg);
  padding: 30px clamp(16px,4vw,48px) 24px; text-align: center; margin-top: auto;
}
.c-footer-inner { max-width: 640px; margin: 0 auto; }
.c-footer-logo { height: 48px; width: auto; object-fit: contain; }
.c-footer-title { color: rgba(255,255,255,.93); font-size: 13.5px; font-weight: 800; margin-top: 10px; }
.c-footer-sub { color: var(--sg2); font-size: 12px; font-weight: 600; }
.c-footer-flag { display: flex; justify-content: center; margin: 14px 0; }
.c-footer-flag span { height: 4px; width: 46px; }
.c-footer-flag span:nth-child(1) { background: #c0392b; border-radius: 2px 0 0 2px; }
.c-footer-flag span:nth-child(2) { background: rgba(255,255,255,.55); }
.c-footer-flag span:nth-child(3) { background: rgba(0,0,0,.35); border-radius: 0 2px 2px 0; }
.c-footer-copy { font-size: 11.5px; color: rgba(255,255,255,.5); margin-bottom: 5px; }
.c-footer-note { font-size: 10.5px; color: rgba(255,255,255,.26); }
.branch-table-scroll { overflow-x: auto; margin-top: .8rem; border: 1px solid var(--border); border-radius: 12px; }
.branch-table { width: 100%; min-width: 720px; border-collapse: collapse; }
#branchesTableWrap .branch-table { min-width: 920px; }
.stage-picks label { display: inline-flex; align-items: center; gap: .2rem; margin: .15rem .55rem .15rem 0; font-size: .84rem; white-space: nowrap; }
.branch-table th {
  background: var(--sn); color: var(--sg2); text-align: right; font-size: .82rem; font-weight: 800;
  padding: .7rem .65rem; white-space: nowrap;
}
.branch-table td { padding: .55rem .5rem; border-bottom: 1px solid #f0eee9; vertical-align: top; background: #fff; }
.branch-table tr:last-child td { border-bottom: none; }
.branch-table .row-num { width: 46px; text-align: center; font-weight: 800; color: var(--sn); padding-top: .85rem; }
.branch-gov-other { margin-top: .45rem; }
.branch-table .form-control, .branch-table .form-select { background: #fff; }
#branchesLimit { margin-top: .7rem; }
.stats-table { min-width: 920px; }
.branch-table td.stat-label { font-weight: 800; color: var(--sn); white-space: nowrap; padding-top: .85rem; }
.branch-table .row-total { text-align: center; font-weight: 800; color: var(--sn); padding-top: .9rem; }
.branch-table tr.is-total td { background: #f7f4ee; font-weight: 800; color: var(--sn); }
.table-actions { display: flex; justify-content: flex-start; margin-top: .75rem; }
.btn-row {
  background: #fff; color: var(--sn); border: 1.5px solid var(--border); border-radius: 8px;
  padding: .5rem .9rem; font-family: inherit; font-weight: 800; font-size: .84rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem;
}
.btn-row:hover { border-color: var(--sn); }
.btn-row-remove {
  background: transparent; color: var(--error); border: none; font-family: inherit;
  font-weight: 800; cursor: pointer; padding: .45rem .2rem; white-space: nowrap;
}
.upload-stack { display: flex; flex-direction: column; gap: 1rem; }
.declare-box {
  background: #f7f4ee; border: 1px solid var(--border); border-radius: 12px;
  padding: .9rem 1rem; margin-bottom: 1rem; font-weight: 700; color: var(--text-2);
}
input[readonly].form-control { background: #f7f4ee; font-weight: 800; color: var(--sn); }

/* اسم الفرع المولّد تلقائيًا */
.auto-branch-name { display: inline-block; font-weight: 700; color: #13233b; padding: 8px 4px; }
.auto-branch-name.is-pending { color: #8a93a3; font-weight: 500; }
