/* =========================================================
   نتيجة الثانوية العامة — ورقة الأنماط
   ========================================================= */

:root {
    --brand:        #0e7c66;
    --brand-dark:   #0a5b4b;
    --brand-soft:   #e6f4f0;
    --ink:          #14201d;
    --ink-soft:     #5d6b68;
    --line:         #e2e8e6;
    --surface:      #ffffff;
    --bg:           #f4f7f6;

    --ok:   #0e9f6e;
    --warn: #d97706;
    --bad:  #dc2626;

    --radius:     18px;
    --radius-sm:  11px;
    --shadow:     0 1px 2px rgba(16, 40, 34, .05), 0 12px 32px -12px rgba(16, 40, 34, .18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0 0 48px;
    background: var(--bg);
    color: var(--ink);
    font-family: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.7;
}

.wrap {
    width: min(100% - 32px, 860px);
    margin-inline: auto;
}

/* ------------------------- الترويسة ------------------------- */

.site-header {
    background:
        radial-gradient(120% 140% at 85% 0%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff;
    padding: 34px 0 68px;
    text-align: center;
}

.badge-year {
    display: inline-block;
    padding: 3px 14px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
}

.site-header h1 {
    margin: 10px 0 4px;
    font-size: clamp(22px, 4.5vw, 32px);
    font-weight: 800;
}

/* العنوان رابط للصفحة الرئيسية — يبقى بشكله ولا يظهر كرابط */
.site-header h1 a {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color .15s;
}

.site-header h1 a:hover,
.site-header h1 a:focus-visible {
    border-bottom-color: rgba(255, 255, 255, .55);
}

.site-header .sub {
    margin: 0;
    font-size: 15px;
    color: rgba(255, 255, 255, .82);
}

.site-header .sub strong { color: #fff; }

/* ------------------------- العلامة ------------------------- */

/* الاسم العربي وحده في الترويسة. لا يُلصق به «.com»: الكلمة العربية
   ليست هي nategtak اللاتينية، فيخرج «نتيجتك.com» وهو لا اسمُ العلامة
   ولا النطاق الحقيقي. النطاق يظهر كاملًا في التذييل حيث يُقرأ نطاقًا. */
.site-header .brand { letter-spacing: .3px; }

.site-footer strong { color: var(--ink); }

.foot-sep {
    margin-inline: 7px;
    opacity: .5;
}

/* ------------------------- نموذج البحث ------------------------- */

.search-card {
    margin-top: -40px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-soft);
}

.field {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.field input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 13px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
    font: inherit;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.field input::placeholder {
    font-weight: 400;
    letter-spacing: normal;
    color: #a8b5b1;
}

.field input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.field button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.field button:hover  { background: var(--brand-dark); }
.field button:active { transform: translateY(1px); }

.field button svg { width: 18px; height: 18px; fill: currentColor; }

.hint {
    margin: 10px 2px 0;
    font-size: 13px;
    color: var(--ink-soft);
}

/* ------------------------- اختيار النظام ------------------------- */

.systems {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    border: 0;
}

.systems legend {
    float: inline-start;          /* legend لا يقبل flex، فنُخرجه من التدفق */
    margin-inline-end: 10px;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    line-height: 34px;
}

/* يتجاوز .search-card label { display: block } حتى تصطف الخيارات أفقيًا */
.search-card .systems .sys-opt {
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.sys-opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sys-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-soft);
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.sys-box::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid var(--line);
    border-radius: 50%;
    flex: none;
    transition: border-color .15s, box-shadow .15s;
}

.sys-opt input:checked + .sys-box {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.sys-opt input:checked + .sys-box::before {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 8px var(--brand);
}

.sys-opt input:focus-visible + .sys-box {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.sys-opt:hover .sys-box { border-color: var(--brand); }

/* ------------------------- بطاقة واتساب ------------------------- */

.wa-card {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding: 16px 18px;
    border: 1px solid #cfece0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f2fbf6, #ffffff 60%);
}

.wa-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #25d366;
}

.wa-icon svg {
    width: 25px;
    height: 25px;
    fill: #fff;
}

.wa-text {
    flex: 1 1 240px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wa-text strong {
    font-size: 16px;
    font-weight: 800;
}

.wa-text span {
    font-size: 14px;
    color: var(--ink-soft);
}

.wa-number {
    margin-top: 3px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #0f7a4a;
    /* الرقم لاتيني داخل صفحة عربية: bdi + dir تمنع انقلاب ترتيب الخانات */
    direction: ltr;
    unicode-bidi: isolate;
}

.wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    background: #25d366;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, transform .1s;
}

.wa-btn:hover  { background: #1da851; }
.wa-btn:active { transform: translateY(1px); }

.wa-btn svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

/* ------------------------- التنبيهات ------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #fbd5d5;
    border-radius: var(--radius-sm);
    background: #fef3f2;
    color: #a02020;
    font-weight: 600;
}

.alert svg {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 3px;
    fill: currentColor;
}

.empty {
    margin-top: 28px;
    text-align: center;
    color: var(--ink-soft);
}

/* ------------------------- قائمة نتائج البحث بالاسم ------------------------- */

.results {
    margin-top: 18px;
}

.results-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.results-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.results-head .count {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink-soft);
}

.results-note {
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid #fde4c0;
    border-radius: var(--radius-sm);
    background: #fff8ec;
    color: #8a5a08;
    font-size: 13.5px;
    font-weight: 600;
}

.refresh-note {
    border-color: #cfe3f7;
    background: #f2f8fe;
    color: #1d5a8a;
}

.result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hit {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-right: 4px solid var(--ok);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 40, 34, .04);
    transition: border-color .15s, transform .1s, box-shadow .15s;
}

.hit.status-warn    { border-right-color: var(--warn); }
.hit.status-bad     { border-right-color: var(--bad); }
.hit.status-neutral { border-right-color: var(--ink-soft); }

.hit:hover {
    border-color: var(--brand);
    box-shadow: 0 6px 18px -10px rgba(16, 40, 34, .35);
}

.hit:hover .hit-arrow { transform: translateX(-3px); }

.hit-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
}

.hit-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: none;
}

.hit-seat {
    font-size: 13px;
    color: var(--ink-soft);
    white-space: nowrap;
}

.hit-pill {
    padding: 3px 12px;
    border-radius: 999px;
    background: #eef3f1;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.hit.status-ok   .hit-pill { background: #e8f8f1; color: #07724f; }
.hit.status-warn .hit-pill { background: #fef4e6; color: #9a5b06; }
.hit.status-bad  .hit-pill { background: #fdeaea; color: #a71d1d; }

/* علامة النظام القديم — تغلب تلوين الحالة لأنها تمييز لا حالة */
.hit .sys-pill,
.hit.status-ok   .sys-pill,
.hit.status-warn .sys-pill,
.hit.status-bad  .sys-pill {
    background: #eceaf6;
    color: #4b3f8f;
    border: 1px solid #d9d4ee;
}

.hit-arrow {
    flex: none;
    width: 20px;
    height: 20px;
    fill: var(--ink-soft);
    transition: transform .15s;
}

@media (max-width: 560px) {
    .hit { flex-wrap: wrap; }
    .hit-name { flex: 1 1 100%; }
    .hit-arrow { margin-inline-start: auto; }
}

/* ------------------------- بطاقة النتيجة ------------------------- */

.result-card {
    margin-top: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--ok);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.result-card.status-warn    { border-top-color: var(--warn); }
.result-card.status-bad     { border-top-color: var(--bad); }
.result-card.status-neutral { border-top-color: var(--ink-soft); }

.result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fafcfb, #fff);
}

.result-head .label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

.result-head h2 {
    margin: 2px 0 6px;
    font-size: clamp(19px, 3.6vw, 25px);
    font-weight: 800;
    line-height: 1.4;
}

.result-head .seat {
    font-size: 14px;
    color: var(--ink-soft);
}

.result-head .seat strong {
    color: var(--ink);
    letter-spacing: .05em;
}

.status-pill {
    padding: 7px 18px;
    border-radius: 999px;
    background: #e8f8f1;
    color: #07724f;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.status-warn    .status-pill { background: #fef4e6; color: #9a5b06; }
.status-bad     .status-pill { background: #fdeaea; color: #a71d1d; }
.status-neutral .status-pill { background: #eef1f0; color: #4b5854; }

/* ------------------------- الجسم ------------------------- */

.result-body {
    display: flex;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
    padding: 24px 22px;
}

.ring {
    --size: 148px;
    flex: none;
    width: var(--size);
    height: var(--size);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--ok) calc(var(--p) * 1%), #eaf0ee 0);
}

.status-warn    .ring { background: conic-gradient(var(--warn) calc(var(--p) * 1%), #eaf0ee 0); }
.status-bad     .ring { background: conic-gradient(var(--bad)  calc(var(--p) * 1%), #eaf0ee 0); }
.status-neutral .ring { background: conic-gradient(var(--ink-soft) calc(var(--p) * 1%), #eaf0ee 0); }

.ring-inner {
    width: calc(var(--size) - 26px);
    height: calc(var(--size) - 26px);
    display: grid;
    place-content: center;
    text-align: center;
    border-radius: 50%;
    background: var(--surface);
}

.ring-value {
    display: block;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.2;
}

.ring-value small {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-soft);
}

.ring-label {
    font-size: 12px;
    color: var(--ink-soft);
}

.stats {
    flex: 1 1 320px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
}

.stat.total { grid-column: 1 / -1; }

.stat-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.5;
}

.stat.total .stat-value { font-size: 30px; }

.stat .of {
    margin-inline-start: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}

.bar {
    height: 8px;
    margin-top: 8px;
    border-radius: 999px;
    background: #e8eeec;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #23b892);
}

.status-warn .bar span { background: linear-gradient(90deg, #b45309, #f59e0b); }
.status-bad  .bar span { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.stat-value.muted {
    font-size: 17px;
    color: var(--ink-soft);
}

.grade-excellent { color: #07724f; }
.grade-vgood     { color: #0e7c66; }
.grade-good      { color: #1d69a8; }
.grade-accepted  { color: #9a5b06; }
.grade-weak      { color: #a71d1d; }

/* ------------------------- جدول المواد ------------------------- */

.subjects {
    padding: 4px 22px 18px;
    border-top: 1px solid var(--line);
}

.subjects-title {
    margin: 16px 0 10px;
    font-size: 16px;
    font-weight: 800;
}

.subjects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

.subjects-table th,
.subjects-table td {
    padding: 9px 10px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.subjects-table th {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft);
}

.subjects-table td { font-weight: 700; }
.subjects-table td.num { font-variant-numeric: tabular-nums; }
.subjects-table tbody tr:last-child td { border-bottom: 0; }
.subjects-table tbody tr:nth-child(odd) { background: #fbfdfc; }

.subjects-table .of-max {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.subjects-table .not-counted td { color: var(--ink-soft); font-weight: 600; }

.nc-badge {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #eef1f0;
    color: #4b5854;
    font-size: 11.5px;
    font-weight: 700;
}

/* المواد تحت حد النجاح */
.subjects-table .below-pass td {
    background: #fdf2f2;
    color: #a71d1d;
}

.fail-badge {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 9px;
    border-radius: 999px;
    background: #fbdcdc;
    color: #a71d1d;
    font-size: 11.5px;
    font-weight: 800;
}

.retake {
    margin: 0 22px 4px;
    padding: 14px 16px;
    border: 1px solid #f3c6c6;
    border-inline-start: 4px solid var(--bad);
    border-radius: var(--radius-sm);
    background: #fdf2f2;
}

.retake-title {
    margin: 0 0 10px;
    font-size: 15.5px;
    font-weight: 800;
    color: #8f1b1b;
}

.retake-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.retake-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 7px 11px;
    border-radius: 8px;
    background: #fff;
}

.retake-name {
    flex: 1 1 130px;
    font-size: 14.5px;
    font-weight: 800;
    color: #8f1b1b;
}

.retake-mark {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.retake-need {
    font-size: 12.5px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}

.retake-note {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.8;
    color: #8a5a08;
}

.retake-unknown {
    margin: 0;
    color: #8f1b1b;
}

.subjects-note {
    margin: 10px 2px 0;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.ghost.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.ghost.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ------------------------- تذييل البطاقة ------------------------- */

.result-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: #fafcfb;
}

.ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.ghost:hover { border-color: var(--brand); color: var(--brand); }
.ghost svg   { width: 17px; height: 17px; fill: currentColor; }

.ring-muted { background: #eaf0ee !important; }

.ring-dash {
    font-size: 30px;
    color: var(--ink-soft);
}

.missing-note {
    flex: 1 1 100%;
    padding: 10px 14px;
    border: 1px solid #fde4c0;
    border-radius: var(--radius-sm);
    background: #fff8ec;
    color: #8a5a08 !important;
    font-size: 13.5px !important;
    line-height: 1.8;
}

.missing-note strong { color: #8a5a08; }

.result-foot .note {
    flex: 1 1 100%;
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--ink-soft);
}

/* ------------------------- دليل التنسيق ------------------------- */

.tanseeq {
    margin-top: 18px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tanseeq-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tanseeq-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.tanseeq-head .tag {
    padding: 3px 12px;
    border-radius: 999px;
    background: #eef3f1;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 700;
}

/* الترتيب */
.rank-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
}

.rank-figure {
    flex: none;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.rank-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

.rank-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--brand);
}

.rank-of {
    font-size: 13px;
    color: var(--ink-soft);
}

.rank-bar-wrap { flex: 1 1 240px; min-width: 0; }

.rank-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #dbe7e3, #eef3f1);
    overflow: visible;
}

/* التعبئة تمثل من هم دونك في الترتيب */
.rank-fill {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #23b892, var(--brand));
}

.rank-pin {
    position: absolute;
    top: 50%;
    width: 4px;
    height: 22px;
    margin-inline-start: -2px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--ink);
}

.rank-caption {
    margin: 10px 0 0;
    font-size: 13.5px;
    color: var(--ink-soft);
}

.rank-caption strong { color: var(--ink); }

.rank-tie {
    margin: 6px 0 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-soft);
    opacity: .85;
}

.tanseeq-note {
    margin-top: 14px;
    padding: 12px 15px;
    border: 1px solid #fde4c0;
    border-radius: var(--radius-sm);
    background: #fff8ec;
    color: #8a5a08;
    font-size: 13.5px;
    line-height: 1.8;
}

.tanseeq-pick {
    margin: 16px 0 8px;
    font-size: 14px;
    font-weight: 700;
}

/* الشعب */
.branches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.branch {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
    overflow: hidden;
}

.branch summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    list-style: none;
}

.branch summary::-webkit-details-marker { display: none; }

.branch summary::before {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--brand);
    border-bottom: 2px solid var(--brand);
    transform: rotate(135deg);
    transition: transform .18s;
}

.branch[open] summary::before { transform: rotate(45deg); }

.branch-name {
    flex: 1 1 auto;
    font-size: 15px;
    font-weight: 800;
}

/* شعبة الطالب نفسه: مميّزة ومفتوحة */
.branch-mine {
    border-color: var(--brand);
    background: #f6fbf9;
}

.mine-badge {
    display: inline-block;
    margin-inline-start: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

.tanseeq-other {
    margin: 10px 0 0;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.branch-count {
    padding: 2px 11px;
    border-radius: 999px;
    background: #e8f8f1;
    color: #07724f;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.faculty-list {
    list-style: none;
    margin: 0;
    padding: 4px 15px 12px;
}

.fac {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
}

.fac:last-child { border-bottom: 0; }

.fac-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ink-soft);
}

.fac-likely     .fac-dot, .fac-dot.likely     { background: var(--ok); }
.fac-borderline .fac-dot, .fac-dot.borderline { background: var(--warn); }
.fac-unlikely   .fac-dot, .fac-dot.unlikely   { background: #c9d3d0; }

.fac-name {
    flex: 1 1 140px;
    font-size: 14.5px;
    font-weight: 700;
}

.fac-min {
    font-size: 12.5px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fac-state {
    padding: 2px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    background: #eef1f0;
    color: #4b5854;
}

.fac-likely     .fac-state { background: #e8f8f1; color: #07724f; }
.fac-borderline .fac-state { background: #fef4e6; color: #9a5b06; }

.fac-unlikely { opacity: .62; }

.tanseeq-legend {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin: 14px 0 0;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.tanseeq-legend .fac-dot { margin-inline-start: 8px; }
.tanseeq-legend .fac-dot:first-child { margin-inline-start: 0; }

/* ------------------------- المساعدة والأسئلة الشائعة ------------------------- */

.help {
    margin-top: 30px;
    padding: 20px 22px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.help-title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 800;
}

/* الخطوات */
.help-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
}

.step-num {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.step strong {
    display: block;
    font-size: 14.5px;
    font-weight: 800;
}

.step span:not(.step-num) {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.6;
}

/* الأسئلة: details/summary أصلية بلا جافاسكربت */
.faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq details {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdfc;
    overflow: hidden;
}

.faq summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    transition: color .15s;
}

.faq summary::-webkit-details-marker { display: none; }

/* علامة + / − تدور عند الفتح */
.faq summary::before {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--brand);
    border-bottom: 2px solid var(--brand);
    transform: rotate(135deg);
    transition: transform .18s;
}

.faq details[open] summary::before { transform: rotate(45deg); }
.faq summary:hover { color: var(--brand); }

.faq details[open] summary {
    border-bottom: 1px solid var(--line);
}

.faq p,
.faq ul {
    margin: 0;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.85;
    color: var(--ink-soft);
}

.faq p + p,
.faq ul + p,
.faq p + ul { padding-top: 0; }

.faq strong { color: var(--ink); }

.faq a {
    color: var(--brand);
    font-weight: 700;
}

/* الاسم المتخطَّى في مثال شرح البحث */
.faq .skip {
    padding: 0 3px;
    border-radius: 3px;
    background: #fff3d6;
    color: #8a5a08;
    text-decoration: line-through;
    text-decoration-color: rgba(138, 90, 8, .5);
}

.faq-note {
    color: var(--ink-soft);
    font-size: 13.5px !important;
}

/* جدول التقديرات */
.grade-table,
.case-list {
    list-style: none;
}

.grade-table li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
}

.grade-table li:last-child { border-bottom: 0; }

.g-name {
    font-weight: 800;
    color: var(--ink);
}

.g-range { font-variant-numeric: tabular-nums; }

.g-marks {
    color: var(--ink-soft);
    font-size: 13px;
}

.case-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 5px 0;
}

.case-list .dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.case-list .dot.ok   { background: var(--ok); }
.case-list .dot.warn { background: var(--warn); }
.case-list .dot.bad  { background: var(--bad); }

.site-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
}

/* ------------------------- الطباعة ------------------------- */

@media print {
    body { background: #fff; padding: 0; }

    .site-header { padding: 16px 0; background: none; color: var(--ink); }
    .badge-year  { border-color: var(--line); background: none; color: var(--ink); }

    .search-card,
    .wa-card,
    .help,
    .results,
    .result-foot,
    .site-footer,
    .alert { display: none !important; }

    .result-card { margin: 0; box-shadow: none; }
    .ring        { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
