/* ==========================================================
   الحج والعمرة — نفس نظام الهوية البصرية
   ========================================================== */

@font-face {
    font-family: "IPSArabic";
    src: url("../IPSArabic/IBMPlexSansArabic-Light.ttf") format("truetype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IPSArabic";
    src: url("../IPSArabic/IBMPlexSansArabic-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IPSArabic";
    src: url("../IPSArabic/IBMPlexSansArabic-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IPSArabic";
    src: url("../IPSArabic/IBMPlexSansArabic-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IPSArabic";
    src: url("../IPSArabic/IBMPlexSansArabic-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ألوان الهوية */
    --forest: #002623;        /* الأخضر الغابي الداكن */
    --green: #054239;         /* الأخضر الدمشقي */
    --teal: #428177;          /* الأخضر الزيتي الفاتح */
    --gold: #b9a779;          /* الذهبي القمحي */
    --gold-dark: #988561;
    --gold-soft: #f3efe3;
    --sand: #edebe0;          /* الرملي */
    --umber: #6b1f2a;         /* الخمري */
    --umber-soft: #f7ecec;

    /* واجهة */
    --bg: #f7f6f1;
    --panel: #ffffff;
    --text: #1b2321;
    --muted: #5d6b67;
    --line: #dfdccf;
    --line-soft: #ece9df;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(0, 38, 35, .06), 0 8px 28px rgba(0, 38, 35, .07);
    --shadow-lg: 0 18px 50px rgba(0, 38, 35, .18);
    --focus: 0 0 0 3px rgba(185, 167, 121, .45);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: "IPSArabic", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--green);
}

::selection {
    background: var(--gold);
    color: var(--forest);
}

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

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

.site-header {
    position: relative;
    color: #fff;
    background:
        radial-gradient(1200px 400px at 85% -20%, rgba(66, 129, 119, .55), transparent 60%),
        radial-gradient(800px 300px at 0% 120%, rgba(185, 167, 121, .18), transparent 60%),
        linear-gradient(160deg, var(--green) 0%, var(--forest) 75%);
    padding-bottom: 86px;
    overflow: hidden;
}

/* زخرفة هندسية خفيفة */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .07;
    background-image:
        linear-gradient(45deg, var(--gold) 1px, transparent 1px),
        linear-gradient(-45deg, var(--gold) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
    pointer-events: none;
}

/* خط ذهبي سفلي */
.site-header::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent);
}

.topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(185, 167, 121, .25);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    flex: none;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 1px;
    line-height: 1;
}

.brand-text {
    display: grid;
    line-height: 1.35;
}

.brand-country {
    font-size: 12.5px;
    color: var(--gold);
    font-weight: 500;
    letter-spacing: .3px;
}

.brand-org {
    font-size: 17px;
    font-weight: 700;
}

.topbar-tag {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .78);
    border: 1px solid rgba(185, 167, 121, .45);
    border-radius: 999px;
    padding: 5px 14px;
    white-space: nowrap;
}

.hero {
    position: relative;
    padding: 38px 0 0;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--gold);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.hero-eyebrow::before {
    content: "";
    width: 28px;
    height: 2px;
    background: var(--gold);
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(26px, 3.4vw, 42px);
    font-weight: 700;
    line-height: 1.25;
}

.hint {
    color: rgba(255, 255, 255, .78);
    font-size: 15px;
    max-width: 680px;
}

/* ---------- المحتوى ---------- */

.content {
    flex: 1;
    margin-top: -62px;
    position: relative;
    z-index: 2;
    padding-bottom: 40px;
}

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

.search {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-lg);
}

.search form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 230px 150px 170px auto;
    gap: 12px;
    align-items: end;
}

.search label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
}

input,
select,
textarea {
    width: 100%;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fcfbf8;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    padding: 0 14px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

input[type="search"] {
    padding-inline-start: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23988561' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23054239' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    text-overflow: ellipsis;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--gold);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold-dark);
    background-color: #fff;
    box-shadow: var(--focus);
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23988561' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

input::placeholder {
    color: #9aa39f;
}

.actions {
    display: flex;
    gap: 8px;
}

button,
.reset,
.primary-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 22px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
}

button[type="submit"],
.primary-link {
    border: 0;
    background: var(--green);
    color: #fff;
    min-width: 110px;
}

button[type="submit"]:hover,
.primary-link:hover {
    background: var(--forest);
}

button[type="submit"]:active {
    transform: translateY(1px);
}

button:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.reset,
.secondary-link {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}

.reset:hover,
.secondary-link:hover {
    border-color: var(--gold);
    color: var(--green);
    background: var(--gold-soft);
}

/* ==========================================================
   عرض البيانات بنمط Oracle APEX — Interactive Report / Redwood
   ========================================================== */

.report {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 14px;
}

/* رأس التقرير */
.report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.report-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--forest);
}

.report-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding-inline: 10px 4px;
    border: 1px solid #cfd8d5;
    border-radius: 4px;
    background: #eef4f2;
    font-size: 12.5px;
    max-width: 340px;
}

.chip-label {
    color: var(--muted);
}

.chip-label::after {
    content: ":";
}

.chip-value {
    color: var(--forest);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-remove {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    line-height: 1;
}

.chip-remove:hover {
    background: var(--umber-soft);
    color: var(--umber);
}

.chip-clear {
    display: inline-flex;
    align-items: center;
    height: 28px;
    font-size: 12.5px;
    color: var(--teal);
}

/* شريط الأدوات */
.report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 8px 16px;
    background: #f7f7f4;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.toolbar-range b {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.toolbar-sort {
    margin-inline-start: 14px;
    padding-inline-start: 14px;
    border-inline-start: 1px solid var(--line);
}

.toolbar-sort a {
    color: var(--teal);
}

.toolbar-rows {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-rows label {
    display: inline;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.toolbar-rows select {
    width: auto;
    height: 30px;
    padding: 0 10px;
    padding-inline-end: 28px;
    font-size: 13px;
    border-radius: 4px;
    background-color: #fff;
    background-position: left 9px center;
}

/* الشبكة */
.report-grid {
    overflow: auto;
    max-height: min(72vh, 900px);
    outline: none;
}

.report-grid:focus-visible {
    box-shadow: inset var(--focus);
}

.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    line-height: 1.5;
}

.grid th,
.grid td {
    border-bottom: 1px solid #e4e2da;
    border-inline-end: 1px solid #ecebe5;
}

.grid th:last-child,
.grid td:last-child {
    border-inline-end: 0;
}

/* رؤوس الأعمدة */
.grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 38px;
    padding: 0;
    background: #f1f0eb;
    color: #2b3330;
    font-weight: 600;
    font-size: 12.5px;
    text-align: start;
    white-space: nowrap;
    border-bottom: 1px solid #cfccc0;
    vertical-align: middle;
}

.grid thead tr.sub th {
    top: 38px;
    height: 34px;
}

.grid thead th[rowspan="2"] {
    border-bottom: 2px solid var(--green);
}

.grid thead tr.sub th {
    border-bottom: 2px solid var(--green);
}

.grid thead th.col-group {
    text-align: center;
    padding: 0 10px;
    background: #e9eee9;
    color: var(--green);
    letter-spacing: .2px;
}

.grid thead th.col-rn {
    padding: 0 8px;
    text-align: center;
    color: var(--muted);
}

.sort-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 100%;
    min-height: inherit;
    padding: 9px 10px;
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    background: #e6e4dc;
    color: var(--forest);
}

.sort-ico {
    flex: none;
    width: 10px;
    height: 14px;
    opacity: .28;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 9 5.5H1zM5 13 1 8.5h8z' fill='%23054239'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sort-link:hover .sort-ico {
    opacity: .6;
}

th[aria-sort="ascending"],
th[aria-sort="descending"] {
    background: #e4ece8 !important;
    color: var(--forest) !important;
}

th[aria-sort="ascending"] .sort-ico {
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 9 5.5H1z' fill='%23054239'/%3E%3Cpath d='M5 13 1 8.5h8z' fill='%23054239' opacity='.2'/%3E%3C/svg%3E");
}

th[aria-sort="descending"] .sort-ico {
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1 9 5.5H1z' fill='%23054239' opacity='.2'/%3E%3Cpath d='M5 13 1 8.5h8z' fill='%23054239'/%3E%3C/svg%3E");
}

.grid thead th.col-num .sort-link {
    flex-direction: row-reverse;
}

/* الخلايا */
.grid tbody td {
    padding: 8px 10px;
    vertical-align: top;
    background: #fff;
    color: var(--text);
}

.grid tbody tr:nth-child(even) td {
    background: #fafaf7;
}

.grid tbody tr:hover td {
    background: #f2f6f4;
}

.grid tbody tr:hover td.col-hs,
.grid tbody tr:hover td.col-rn {
    background: #e9f0ed;
}

/* عمود رقم الصف + HS مثبّتان */
.grid .col-rn {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    width: 48px;
    min-width: 48px;
    text-align: center;
    color: #8a938f;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.grid .col-hs {
    position: sticky;
    inset-inline-start: 48px;
    z-index: 1;
    min-width: 116px;
    box-shadow: inset -1px 0 0 #d6d3c7;
}

.grid thead .col-rn,
.grid thead .col-hs {
    z-index: 4;
}

.grid tbody td.col-rn {
    background: #f7f7f4;
}

.grid tbody tr:nth-child(even) td.col-rn {
    background: #f2f2ee;
}

.hs,
.mono {
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: .2px;
}

.hs {
    font-weight: 700;
    color: var(--green);
}

.col-item .mono {
    color: var(--teal);
    font-weight: 500;
}

.grid .col-section,
.grid .col-chapter,
.grid .col-page {
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: #4c5753;
}

.grid tbody .col-section {
    cursor: help;
}

.grid .col-type {
    min-width: 170px;
    color: #4c5753;
}

.grid .col-name {
    min-width: 260px;
}

.grid .col-unit {
    white-space: nowrap;
    text-align: center;
}

/* الأعمدة الرقمية: محاذاة لنهاية الخلية كما في Oracle */
.grid .col-num {
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 92px;
}

.grid tbody td.col-total {
    font-weight: 700;
    color: var(--forest);
    background-image: linear-gradient(rgba(185, 167, 121, .14), rgba(185, 167, 121, .14));
}

.nil {
    color: #b3b8b5;
}

/* إبراز صفوف القائمة السلبية (Highlight rule) */
.grid tbody tr.is-negative td {
    background-color: #fcf5f5;
}

.grid tbody tr.is-negative td.col-rn {
    box-shadow: inset -3px 0 0 var(--umber);
    color: var(--umber);
    font-weight: 600;
}

.grid tbody tr.is-negative td.col-num {
    color: var(--umber);
}

.negative {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 0 7px;
    border-radius: 3px;
    background: var(--umber);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    vertical-align: 1px;
    white-space: nowrap;
}

.report-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* تذييل التقرير */
.report-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 8px 16px;
    background: #f7f7f4;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

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

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.pagination a:hover {
    border-color: #cfd8d5;
    background: #fff;
}

.pagination .pg-step,
.pagination .pg-edge {
    font-size: 16px;
    border-color: var(--line);
    background: #fff;
}

.pagination .current {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    font-weight: 700;
}

.pagination .disabled {
    color: #c0c4c1;
}

.pagination .pg-step.disabled,
.pagination .pg-edge.disabled {
    background: transparent;
}


/* ---------- حالات ---------- */

.empty,
.error {
    padding: 36px 20px;
    border-radius: var(--radius);
    text-align: center;
    font-size: 15px;
}

.empty {
    background: var(--panel);
    border: 1px dashed var(--gold);
    color: var(--muted);
}

.empty::before {
    content: "";
    display: block;
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23b9a779' stroke-width='1.6' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5M8.5 11h5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.error {
    background: var(--umber-soft);
    color: var(--umber);
    border: 1px solid rgba(107, 31, 42, .25);
    font-weight: 500;
}

/* ---------- التذييل ---------- */

.site-footer {
    background: var(--forest);
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
    border-top: 3px solid var(--gold);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 18px 0;
}

.site-footer a {
    color: var(--gold);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ---------- صفحة الخطأ ---------- */

.error-page {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 40px 0 60px;
}

.error-card {
    width: min(560px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
    text-align: center;
}

.error-code {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    margin-bottom: 12px;
}

.error-card h1 {
    color: var(--green);
    font-size: 26px;
}

.error-card p {
    color: var(--muted);
    margin: 0 0 24px;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.site-header.compact {
    padding-bottom: 0;
}

/* ---------- استجابة الشاشات ---------- */

@media (max-width: 1100px) {
    .search form {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .suggest-field {
        grid-column: 1 / -1;
    }

    .actions {
        grid-column: 1 / -1;
    }

    .actions button {
        flex: 1;
    }
}

@media (max-width: 760px) {
    .wrap {
        width: calc(100% - 24px);
    }

    .topbar-tag {
        display: none;
    }

    .brand-org {
        font-size: 15px;
    }

    .brand-logo,
    .brand-mark {
        width: 44px;
        height: 44px;
    }

    .hero {
        padding-top: 26px;
    }

    .hint {
        font-size: 14px;
    }

    .search {
        padding: 16px;
    }

    .search form {
        grid-template-columns: 1fr 1fr;
    }

    .search form > label:nth-of-type(2) {
        grid-column: 1 / -1;
    }

    .report-grid {
        max-height: 75vh;
    }

    .grid .col-type {
        min-width: 150px;
    }

    .grid .col-name {
        min-width: 200px;
    }

    .report-foot {
        justify-content: center;
    }

    .foot-range {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .search form {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .actions button,
    .actions .reset {
        flex: none;
        width: 100%;
    }
}

@media print {
    .site-header,
    .search,
    .pagination,
    .site-footer,
    .report-toolbar form,
    .chip-remove,
    .chip-clear {
        display: none;
    }

    .report-grid {
        max-height: none;
        overflow: visible;
    }

    .content {
        margin-top: 0;
    }

    .grid thead th {
        position: static;
    }
}


/* ==========================================================
   صفحة طلب الخدمة
   ========================================================== */

.brand-mark svg {
    width: 30px;
    height: 30px;
}

.brand-mark.big {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    color: var(--gold-dark);
    border-color: var(--gold);
}

.brand-mark.big svg {
    width: 40px;
    height: 40px;
}

.topbar-phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, border-color .15s;
}

.topbar-phone:hover {
    background: rgba(185, 167, 121, .15);
    border-color: var(--gold);
}

.topbar-phone svg {
    width: 16px;
    height: 16px;
    color: var(--gold);
}

.request-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 26px;
    margin-bottom: 26px;
    scroll-margin-top: 20px;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px 16px;
    margin-bottom: 18px;
}

.card-head h2 {
    margin: 0;
    font-size: 22px;
    color: var(--forest);
}

.card-head p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.req {
    color: var(--umber);
}

.request-card .error {
    padding: 12px 16px;
    margin-bottom: 18px;
    text-align: start;
    font-size: 14px;
}

.hp {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

legend {
    padding: 0;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
}

/* بطاقات الخدمات */
.service-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 1100px) {
    .service-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.site-footer .footer-inner {
    padding-inline-end: 72px;
}

.service-tile {
    position: relative;
    display: block;
    cursor: pointer;
}

.service-tile input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tile-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fcfbf8;
    transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
}

.service-tile:hover .tile-body {
    border-color: var(--gold);
    background: #fff;
}

.service-tile input:focus-visible + .tile-body {
    box-shadow: var(--focus);
}

.service-tile input:checked + .tile-body {
    border-color: var(--green);
    background: #f1f6f4;
    box-shadow: inset 0 0 0 1px var(--green);
}

.tile-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold-dark);
    transition: background .15s, color .15s;
}

.tile-icon svg {
    width: 24px;
    height: 24px;
}

.service-tile input:checked + .tile-body .tile-icon {
    background: var(--green);
    color: var(--gold);
}

.tile-text {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.tile-title {
    font-weight: 700;
    font-size: 15.5px;
    color: var(--forest);
}

.tile-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--muted);
}

.tile-check {
    display: grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    color: transparent;
    transition: all .15s;
}

.tile-check svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}

.service-tile input:checked + .tile-body .tile-check {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.services.has-error .tile-body {
    border-color: rgba(107, 31, 42, .45);
}

/* الحقول */
.fields {
    display: grid;
    grid-template-columns: 1fr 1fr 150px;
    gap: 16px;
    margin-top: 22px;
}

.field {
    display: grid;
    gap: 7px;
    align-content: start;
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
}

.field small {
    font-weight: 400;
    color: var(--muted);
}

.field-wide {
    grid-column: 2 / -1;
}

textarea {
    height: auto;
    min-height: 48px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.6;
}

input[type="tel"] {
    text-align: right;
}

input[type="tel"]::placeholder {
    text-align: right;
}

[aria-invalid="true"] {
    border-color: var(--umber) !important;
    background: #fffafa !important;
}

.field-error {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--umber);
}

.services .field-error {
    margin-top: 14px;
}

.contact-method legend {
    margin-bottom: 7px;
    font-size: 14px;
}

.segmented {
    display: flex;
    height: 48px;
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fcfbf8;
}

.segmented label {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.segmented input {
    position: absolute;
    opacity: 0;
}

.segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 100%;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.segmented svg {
    width: 17px;
    height: 17px;
}

.segmented input:checked + span {
    background: var(--green);
    color: #fff;
}

.segmented input:focus-visible + span {
    box-shadow: var(--focus);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line-soft);
}

.form-actions button {
    min-width: 200px;
    height: 52px;
    font-size: 16px;
}

.privacy-note {
    font-size: 12.5px;
    color: var(--muted);
}

/* رسالة النجاح */
.success {
    text-align: center;
    padding: 18px 0 6px;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--green);
    color: var(--gold);
    box-shadow: 0 0 0 8px var(--gold-soft);
}

.success-icon svg {
    width: 34px;
    height: 34px;
    stroke-width: 2.4;
}

.success h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: var(--forest);
}

.success p {
    max-width: 520px;
    margin: 0 auto 16px;
    color: var(--muted);
}

.success strong {
    color: var(--green);
}

.success-code {
    display: inline-block;
    margin-bottom: 20px;
    padding: 8px 18px;
    border: 1px dashed var(--gold);
    border-radius: 8px;
    background: var(--gold-soft);
    font-size: 14px;
    color: var(--muted);
}

.success-code b {
    color: var(--forest);
    font-size: 17px;
    margin-inline-start: 6px;
    letter-spacing: .5px;
}

/* الخطوات */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.step-no {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    color: var(--gold-dark);
    font-weight: 700;
}

.step b {
    color: var(--forest);
}

.step p {
    margin: 2px 0 0;
    font-size: 13.5px;
    color: var(--muted);
}

/* زر واتساب العائم */
.wa-float {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 50;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    border: 2px solid var(--gold);
    box-shadow: 0 10px 28px rgba(0, 38, 35, .35);
    transition: transform .15s, background .15s;
}

.wa-float:hover {
    transform: translateY(-2px);
    background: var(--forest);
}

.wa-float svg {
    width: 28px;
    height: 28px;
}

/* ==========================================================
   لوحة الإدارة
   ========================================================== */

.is-admin .site-header.compact::after {
    height: 3px;
}

.topbar-form {
    margin: 0;
}

.topbar-form .topbar-tag {
    height: auto;
    background: transparent;
    font-weight: 500;
    font-size: 12.5px;
}

.topbar-form .topbar-tag:hover {
    background: rgba(185, 167, 121, .15);
    color: #fff;
}

.login-card h1 {
    color: var(--green);
}

.login-card .error {
    padding: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}

.login-form {
    display: flex;
    gap: 8px;
}

.login-form button {
    min-width: 90px;
}

.admin-main {
    flex: 1;
    padding: 26px 0 40px;
}

.admin-title {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-title h1 {
    margin: 0;
    color: var(--forest);
    font-size: 26px;
}

.secondary-link.small {
    height: 38px;
    padding: 0 14px;
    font-size: 13.5px;
}

.stat-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: border-color .15s, background .15s;
}

.stat b {
    font-size: 22px;
    color: var(--forest);
    font-variant-numeric: tabular-nums;
}

.stat:hover {
    background: #fcfbf8;
}

.stat.active {
    border-color: var(--green);
    background: #f1f6f4;
    color: var(--green);
    font-weight: 600;
}

.stat-new { border-inline-start-color: var(--gold); }
.stat-contacted { border-inline-start-color: var(--teal); }
.stat-done { border-inline-start-color: var(--green); }
.stat-cancelled { border-inline-start-color: #a9aeab; }

.report-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.report-filters input {
    flex: 1 1 260px;
    height: 38px;
    font-size: 14px;
    padding-inline-start: 38px;
    background-position: right 12px center;
}

.report-filters select {
    flex: 0 1 200px;
    height: 38px;
    font-size: 14px;
}

.report-filters button,
.report-filters .reset {
    height: 38px;
    padding: 0 18px;
    font-size: 14px;
    min-width: 0;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.toolbar-btn:hover {
    border-color: var(--gold);
    background: var(--gold-soft);
}

.th-plain {
    display: block;
    padding: 9px 10px;
}

.grid .col-code {
    white-space: nowrap;
}

.grid .col-date {
    white-space: nowrap;
}

.grid .col-date small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
}

.grid .col-name {
    min-width: 160px;
    font-weight: 600;
}

.grid .col-phone {
    white-space: nowrap;
}

.grid .col-phone a.mono {
    color: var(--text);
    text-decoration: none;
}

.grid .col-phone a.mono:hover {
    color: var(--green);
    text-decoration: underline;
}

.wa-mini {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-inline-start: 6px;
    border-radius: 6px;
    color: var(--green);
    vertical-align: middle;
    border: 1px solid var(--line);
}

.wa-mini:hover {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.wa-mini svg {
    width: 16px;
    height: 16px;
}

.svc-tag {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 4px;
    background: var(--gold-soft);
    border: 1px solid #e6dcc3;
    color: #6f5f38;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.grid .col-method {
    white-space: nowrap;
    color: var(--muted);
}

.grid .col-notes {
    min-width: 220px;
    max-width: 380px;
    color: #4c5753;
    font-size: 12.5px;
}

.status-form {
    margin: 0;
}

.status-select {
    width: auto;
    height: 30px;
    padding: 0 10px;
    padding-inline-end: 28px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 999px;
    background-position: left 9px center;
}

.status-new { background-color: #fbf5e6; border-color: #e3d3a8; color: #7a6326; }
.status-contacted { background-color: #ecf4f2; border-color: #b9d2cc; color: #2f6b61; }
.status-done { background-color: #e6efec; border-color: #9fbdb5; color: var(--green); }
.status-cancelled { background-color: #f1f1ef; border-color: #d6d6d2; color: #7c817e; }

.grid tbody tr.row-new td.col-code {
    box-shadow: inset -3px 0 0 var(--gold);
}

.grid tbody tr.row-cancelled td {
    color: #9aa09d;
}

/* ---------- استجابة صفحة الطلب ---------- */

@media (max-width: 900px) {
    .fields {
        grid-template-columns: 1fr 1fr;
    }

    .field-wide {
        grid-column: 1 / -1;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .stat-tabs {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .request-card {
        padding: 18px 16px;
    }

    .service-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .tile-body {
        position: relative;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 14px 8px 12px;
        text-align: center;
    }

    .tile-icon {
        width: 40px;
        height: 40px;
    }

    .tile-title {
        font-size: 14px;
        line-height: 1.4;
    }

    .tile-desc {
        display: none;
    }

    .tile-check {
        position: absolute;
        top: 8px;
        inset-inline-end: 8px;
        width: 18px;
        height: 18px;
    }

    .tile-check svg {
        width: 11px;
        height: 11px;
    }

    .service-grid .service-tile:last-child {
        grid-column: 1 / -1;
    }

    .fields {
        grid-template-columns: 1fr;
    }

    .form-actions button {
        width: 100%;
    }

    .privacy-note {
        width: 100%;
        text-align: center;
    }

    .stat-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-tabs .stat:first-child {
        grid-column: 1 / -1;
    }

    .wa-float {
        bottom: 16px;
        left: 16px;
        width: 52px;
        height: 52px;
    }
}

/* شعار Viztos */
.site-header .brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    box-shadow: 0 0 0 1.5px rgba(185, 167, 121, .55), 0 6px 18px rgba(0, 0, 0, .25);
}

.brand-latin {
    font-size: 22px;
    letter-spacing: .8px;
    line-height: 1.15;
    text-align: right;
}

.login-logo {
    display: block;
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border-radius: 19px;
    box-shadow: 0 10px 26px rgba(0, 38, 35, .25);
}

@media (max-width: 760px) {
    .site-header .brand-logo {
        width: 44px;
        height: 44px;
        border-radius: 11px;
    }

    .brand-latin {
        font-size: 19px;
    }
}

/* ==========================================================
   إرشاد الأخطاء
   ========================================================== */

.field-hint {
    font-size: 12.5px;
    font-weight: 400;
    color: var(--muted);
}

.field.has-error > span:first-child,
.services.has-error legend {
    color: var(--umber);
}

.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--umber);
    animation: err-in .18s ease-out;
}

.field-error::before {
    content: "!";
    flex: none;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--umber);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

@keyframes err-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: none; }
}

.field.has-error input,
.field.has-error textarea {
    border-color: var(--umber);
    background-color: #fffafa;
}

.field.has-error input:focus,
.field.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(107, 31, 42, .18);
}

.field.is-valid input {
    border-color: #9fbdb5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23428177' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-inline-end: 40px;
}

.field.is-valid input[type="number"] {
    background-image: none;
    padding-inline-end: 14px;
}

.services.has-error .service-grid {
    padding: 8px;
    margin: -8px;
    border-radius: 14px;
    background: #fdf6f6;
    box-shadow: inset 0 0 0 1.5px rgba(107, 31, 42, .35);
}

.services:focus {
    outline: none;
}

.char-count {
    justify-self: end;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.char-count.over {
    color: var(--umber);
    font-weight: 700;
}

/* ملخص الأخطاء */
.error-summary {
    margin-bottom: 20px;
    padding: 14px 18px;
    border: 1px solid rgba(107, 31, 42, .3);
    border-inline-start: 4px solid var(--umber);
    border-radius: 10px;
    background: #fdf6f6;
    color: var(--umber);
    outline: none;
}

.error-summary[hidden] {
    display: none;
}

.summary-title {
    margin: 0;
    font-weight: 700;
    font-size: 14.5px;
}

.error-summary ol {
    margin: 8px 0 0;
    padding-inline-start: 20px;
    font-size: 13.5px;
}

.error-summary li {
    margin: 4px 0;
}

.error-summary a {
    color: var(--umber);
    text-decoration: underline;
    text-decoration-color: rgba(107, 31, 42, .35);
    text-underline-offset: 3px;
}

.error-summary a:hover {
    text-decoration-color: var(--umber);
}

button:disabled {
    opacity: .7;
    cursor: wait;
}

/* شاشة الدخول */
.pw-wrap {
    position: relative;
    flex: 1;
}

.pw-wrap input {
    padding-inline-end: 46px;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
}

.pw-toggle:hover {
    background: var(--gold-soft);
    color: var(--green);
}

.pw-toggle svg {
    width: 20px;
    height: 20px;
}

.login-help {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--muted);
    text-align: start;
}

.caps-warn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fbf5e6;
    border: 1px solid #e3d3a8;
    color: #7a6326;
    font-size: 13px;
    text-align: start;
}

.caps-warn[hidden] {
    display: none;
}

.login-card .error {
    text-align: start;
}
