/* هوية الاستبانة المستقلة: كحلي وعنابي ورملي، بخط «ثمانية» — لا صلة لها بهوية «فصيح» */
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Black.woff') format('woff'); font-weight: 900; font-display: swap; }
:root {
  --navy: #1F2A44; --navy-2: #2C3B5E; --navy-50: #EEF1F7;
  --wine: #8E2C3C; --wine-2: #A8394B; --wine-50: #F8ECEE;
  --sand: #F6F1EA; --sand-2: #EDE4D6; --paper: #FFFFFF;
  --ink: #1B2133; --muted: #6A7286; --line: #E3DCCF;
  --ok: #2E7D5B; --warn: #B7791F; --err: #B42318;
  --r: 18px; --sh: 0 10px 30px rgba(31, 42, 68, .08);
  --font: 'Thmanyah Sans', 'Segoe UI', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--sand); color: var(--ink); font-size: 17px; line-height: 1.85; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--wine); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 18px; }
.wide { max-width: 1180px; }

/* الرأس */
.sv-head { background: var(--navy); color: #fff; padding: 34px 0 30px; position: relative; overflow: hidden; }
.sv-head::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, transparent 2px 22px); }
.sv-head::after { content: ''; position: absolute; inset-inline-start: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(142, 44, 60, .55); }
.sv-head .wrap { position: relative; z-index: 1; }
.sv-kicker { display: inline-block; background: var(--wine); color: #fff; font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 999px; letter-spacing: .2px; }
.sv-head h1 { margin: 12px 0 6px; font-weight: 900; font-size: clamp(24px, 4.2vw, 36px); line-height: 1.4; }
.sv-head p { margin: 0; opacity: .85; font-size: 15px; }
.sv-band { height: 6px; background: linear-gradient(90deg, var(--wine), var(--wine-2) 40%, var(--navy-2)); }

/* البطاقات */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--sh); margin: 18px 0; }
.card h2 { margin: 0 0 10px; font-weight: 900; font-size: 22px; color: var(--navy); }
.card h3 { margin: 18px 0 8px; color: var(--wine); font-weight: 700; font-size: 18px; }
.muted { color: var(--muted); } .small { font-size: 14px; } .xs { font-size: 12.5px; }
.pre { white-space: pre-line; }
.note { background: var(--navy-50); border-inline-start: 4px solid var(--navy); border-radius: 12px; padding: 10px 14px; white-space: pre-line; margin: 6px 0 14px; }
.notice { border-radius: 14px; padding: 12px 16px; margin: 12px 0; background: var(--wine-50); color: var(--wine); font-weight: 500; }
.notice.ok { background: #E7F4EE; color: var(--ok); } .notice.warn { background: #FBF3E3; color: #8A5A10; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* الأزرار */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 20px; font-weight: 700; cursor: pointer; background: var(--wine); color: #fff; text-decoration: none; transition: transform .1s, background .15s, box-shadow .15s; min-height: 44px; }
.btn:hover { background: var(--wine-2); box-shadow: 0 6px 16px rgba(142, 44, 60, .25); }
.btn:active { transform: translateY(1px); }
.btn.navy { background: var(--navy); } .btn.navy:hover { background: var(--navy-2); box-shadow: 0 6px 16px rgba(31, 42, 68, .25); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--navy-50); box-shadow: none; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 14px; border-radius: 10px; }
.btn.danger { background: #fff; color: var(--err); border: 1.5px solid #F2C9C4; } .btn.danger:hover { background: #FDECEA; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon { width: 18px; height: 18px; flex: none; }

/* شريط التقدم */
.prog { position: sticky; top: 0; z-index: 5; background: rgba(246, 241, 234, .95); backdrop-filter: blur(6px); padding: 10px 0; border-bottom: 1px solid var(--line); }
.prog-bar { height: 8px; background: var(--sand-2); border-radius: 99px; overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--wine), var(--navy)); border-radius: 99px; transition: width .3s; }
.prog-txt { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* الأسئلة */
.q { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.q:last-child { border-bottom: 0; }
.q-h { display: flex; gap: 10px; align-items: flex-start; }
.q-n { flex: none; min-width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; padding: 0 6px; }
.q-t { font-weight: 500; font-size: 18px; }
.q-t .req { color: var(--wine); }
.q-body { margin-top: 8px; padding-inline-start: 40px; }
.q-sub { background: var(--wine); color: #fff; display: inline-block; padding: 4px 14px; border-radius: 10px; font-weight: 700; font-size: 16px; margin: 18px 0 4px; }
.ctx { background: var(--sand); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; white-space: pre-line; margin: 6px 0 10px; line-height: 2; }
.lbl { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
textarea, input[type=text], input[type=number], input[type=password], select { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #FFFDF9; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 64px; line-height: 1.8; }
textarea:focus, input:focus, select:focus { outline: 0; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(31, 42, 68, .1); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 16px; cursor: pointer; font-weight: 500; transition: all .12s; }
.pill:hover { border-color: var(--navy); }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill.key { box-shadow: 0 0 0 3px rgba(46, 125, 91, .35); }
.nav { display: flex; gap: 10px; justify-content: space-between; margin: 20px 0 50px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.steps span { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--sand-2); color: var(--muted); }
.steps span.on { background: var(--navy); color: #fff; } .steps span.done { background: var(--wine-50); color: var(--wine); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 0 40px; }
.thanks { text-align: center; padding: 50px 20px; }
.thanks .ring { width: 86px; height: 86px; border-radius: 50%; background: var(--wine-50); color: var(--wine); display: grid; place-items: center; margin: 0 auto 14px; font-size: 42px; }

/* لوحة الباحث */
.top { background: var(--navy); color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.top b { font-weight: 900; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.badge.draft { background: #FBF3E3; color: #8A5A10; } .badge.open { background: #E7F4EE; color: var(--ok); } .badge.closed { background: #FDECEA; color: var(--err); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 20px 0 0; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 18px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.on { color: var(--wine); border-color: var(--wine); }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 4px; margin: 8px 0; } .field > span { font-size: 14px; font-weight: 700; color: var(--navy); }
.sec-ed { border: 1.5px solid var(--line); border-radius: 16px; margin: 14px 0; background: #fff; }
.sec-ed > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 10px; align-items: center; font-weight: 700; color: var(--navy); }
.sec-ed > summary::-webkit-details-marker { display: none; }
.sec-ed[open] > summary { border-bottom: 1px solid var(--line); background: var(--navy-50); border-radius: 16px 16px 0 0; }
.sec-ed .inner { padding: 14px 18px; }
.it-ed { display: grid; grid-template-columns: 30px 130px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.it-ed .n { color: var(--muted); font-size: 13px; padding-top: 10px; text-align: center; }
.it-ed .tools { display: flex; gap: 4px; padding-top: 4px; }
.it-ed .extra { grid-column: 3 / 4; display: grid; gap: 6px; }
.it-ed.heading { background: var(--wine-50); border-radius: 10px; padding: 8px; }
.iconbtn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--navy); }
.iconbtn:hover { background: var(--navy-50); } .iconbtn.del:hover { background: #FDECEA; color: var(--err); }
.savebar { position: sticky; bottom: 0; z-index: 6; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 10px 0; box-shadow: 0 -6px 20px rgba(0,0,0,.05); }
.dirty { color: var(--warn); font-weight: 700; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: start; vertical-align: top; }
table.t th { background: var(--navy-50); color: var(--navy); font-weight: 700; position: sticky; top: 0; }
table.t td.c, table.t th.c { text-align: center; }
.tw { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--wine); }
.kpi .n { font-size: 32px; font-weight: 900; color: var(--navy); line-height: 1.2; } .kpi .l { color: var(--muted); font-size: 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.modal { position: fixed; inset: 0; background: rgba(15, 20, 35, .55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 30px 12px; }
.modal .box { background: var(--sand); border-radius: 20px; width: min(920px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }
.modal .bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--navy); color: #fff; }
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); background: var(--navy); color: #fff; padding: 10px 22px; border-radius: 12px; z-index: 99; box-shadow: var(--sh); font-weight: 500; }
.toast.err { background: var(--err); }
.login { max-width: 420px; margin: 60px auto; }
@media (max-width: 760px) {
  body { font-size: 16px; }
  .card { padding: 18px 16px; }
  .q-body { padding-inline-start: 0; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .it-ed { grid-template-columns: 26px minmax(0, 1fr); }
  .it-ed > select, .it-ed .tools { grid-column: 2 / 3; }
  .it-ed .extra { grid-column: 1 / -1; }
}
@media print {
  body { background: #fff; font-size: 13px; }
  .no-print, .top, .tabs, .savebar, .prog, .nav { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .pb { break-after: page; }
}
.chart svg, .modal svg { direction: ltr; }
