/* إضافات حجزي فوق القالب الأساسي */

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page-head h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.actions form {
    display: inline;
    margin: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.money-pos { color: var(--success, #0f766e); font-weight: 700; }
.money-neg { color: var(--danger, #dc2626); font-weight: 700; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.summary-box {
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--gray-50, #f9fafb);
}

.summary-box span {
    display: block;
    font-size: 12px;
    color: var(--gray-600, #4b5563);
}

.summary-box strong {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--gray-200, #e5e7eb);
}

.item-photo {
    width: 100%;
    max-width: 260px;
    border-radius: 12px;
    border: 1px solid var(--gray-200, #e5e7eb);
}

.empty-row td {
    text-align: center;
    color: var(--gray-400, #9ca3af);
    padding: 28px 12px;
}

.picker {
    display: grid;
    grid-template-columns: 1fr 110px auto;
    gap: 8px;
    align-items: end;
}

.attr-row {
    display: grid;
    grid-template-columns: 1.2fr 140px 1.5fr 90px 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .picker { grid-template-columns: 1fr; }
    .attr-row { grid-template-columns: 1fr 1fr; }
}

@media print {
    .sidebar, .topbar, .admin-footer, .mobile-bottom-nav, .no-print { display: none !important; }
    .main-wrapper { margin: 0 !important; }
    .page-content { padding: 0 !important; }
}

/* ملخص أخطاء النموذج: القالب يخفي alert-error ما لم تُضف له show */
.validation-summary-errors.alert-error { display: block; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 18px; }
.validation-summary-valid { display: none; }

/* تنبيهات التواريخ والحالة: نص ثابت يبقى ظاهراً */
.date-warnings { margin: 4px 0 12px; }
.date-warning, .notice {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.notice-info { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.notice-danger { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.contract { max-width: 800px; margin: 0 auto; background: #fff; padding: 28px; font-size: 14px; }
.contract h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; }
.contract h2 { font-size: 15px; font-weight: 800; margin: 18px 0 8px; border-bottom: 2px solid #111; padding-bottom: 4px; }
.contract table { margin-bottom: 8px; }
.contract th, .contract td { border: 1px solid #d1d5db; padding: 6px 8px; }
.contract .sign { display: flex; justify-content: space-between; margin-top: 48px; }
.contract ol { margin: 0; padding-inline-start: 20px; }

/* التقويم الشهري: سبعة أعمدة تبدأ بالسبت */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}
.cal-head {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-600, #4b5563);
    padding: 4px 0;
}
.cal-day {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 112px;
    padding: 6px;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    background: var(--white, #fff);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
}
.cal-day:hover { border-color: var(--primary, #6b21a8); color: inherit; }
.cal-out { opacity: .45; }
.cal-today { border: 2px solid var(--primary, #6b21a8); }
.cal-date { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; }
.cal-weekday { display: none; font-weight: 600; color: var(--gray-600, #4b5563); }
.cal-chip {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    padding: 0 6px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.cal-pickup { background: #dcfce7; color: #166534; }
.cal-tentative { background: transparent; border: 1px dashed #16a34a; }
.cal-return { background: #ffedd5; color: #9a3412; }
.cal-appt { background: #dbeafe; color: #1e40af; }
.cal-more { font-size: 11px; color: var(--gray-600, #4b5563); }

@media (max-width: 768px) {
    /* على الهاتف: قائمة بالأيام التي فيها أحداث فقط */
    .calendar { grid-template-columns: 1fr; }
    .cal-head, .cal-empty, .cal-out { display: none; }
    .cal-day { min-height: 0; }
    .cal-weekday { display: inline; }
}

/* صور حالة الحجز */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-card { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 10px; overflow: hidden; background: var(--gray-50, #f9fafb); }
.photo-card img { width: 100%; height: 130px; object-fit: cover; display: block; }
.photo-card .photo-meta { padding: 6px 8px; font-size: 12px; }
.photo-card form { margin: 0; }

/* سجل عمليات الحجز */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--gray-200, #e5e7eb); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--gray-600, #4b5563); font-size: 12px; }

.placeholder-key { display: inline-block; margin: 2px; padding: 0 6px; border-radius: 6px; background: var(--gray-100, #f3f4f6); color: inherit; font-size: 12px; }

/* ملصقات الباركود */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.label {
    border: 1px dashed #9ca3af;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    background: #fff;
    color: #000;
    break-inside: avoid;
}
.label svg { max-width: 100%; height: 44px; }
.label-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-code { font-size: 12px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.label-price { font-size: 12px; font-weight: 700; }
@media print {
    .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
    .label { border-style: solid; border-color: #d1d5db; }
}

/* شريط تنبيه الاشتراك وخانة مسح الباركود في الشريط العلوي */
.sub-banner { margin: 0 0 12px; }
.scan-box { display: flex; gap: 6px; align-items: center; margin: 0; }
.scan-box input { width: 190px; height: 38px; }
@media (max-width: 768px) {
    .scan-box input { width: 120px; }
}

/* قائمة الأصناف في نموذج الحجز: المتاح أخضر والمحجوز أحمر */
#itemPicker option.opt-free { color: #166534; background: #f0fdf4; font-weight: 600; }
#itemPicker option.opt-busy { color: #991b1b; background: #fef2f2; }
.opt-legend { display: inline-block; border-radius: 6px; padding: 0 8px; font-weight: 700; }
.opt-legend.opt-free { color: #166534; background: #dcfce7; }
.opt-legend.opt-busy { color: #991b1b; background: #fee2e2; }

/* صفوف الجداول بلونين متناوبين. الصف الأول ملوَّن أيضاً حتى يظهر الصف الوحيد بوضوح. */
.table-wrap tbody tr:nth-child(odd) td { background: color-mix(in srgb, var(--primary, #6b21a8) 5%, transparent); }
.table-wrap tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--primary, #6b21a8) 11%, transparent); }
.table-wrap tbody tr:hover td { background: color-mix(in srgb, var(--primary, #6b21a8) 18%, transparent); }
.table-wrap tbody tr.empty-row td, .table-wrap tbody tr.empty-row:hover td { background: transparent; }
@media print {
    .table-wrap tbody tr td { background: transparent !important; }
}

/* ألوان الواجهة حسب المحل. العنّابي هو الافتراضي (فساتين وأعراس)، والأزرق لمستلزمات المناسبات.
   ألوان الحالات (أخضر، أحمر، أصفر) ثابتة في اللونين. */
:root {
    --primary: #881337;
    --primary-light: #be185d;
    --primary-gradient: linear-gradient(135deg, #881337 0%, #be185d 100%);
    --accent: #c2884a;
    --accent-light: #fbefe0;
}
html[data-brand="blue"] {
    --primary: #1e3a5f;
    --primary-light: #2563eb;
    --primary-gradient: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    --accent: #f59e0b;
    --accent-light: #fef3c7;
}
.auth-bg { background: linear-gradient(135deg, #4c0519 0%, #881337 50%, #be185d 100%); }

/* شاشات الدخول تتبع لون المحل. */
html[data-brand="blue"] .auth-bg { background: linear-gradient(135deg, #0f2440 0%, #1e3a5f 50%, #2563eb 100%); }

/* ميزة ليست في باقة المحل: تبقى ظاهرة لصاحب المحل بقفل. */
.nav-item.nav-locked { opacity: .62; }
.nav-item.nav-locked .nav-lock { margin-inline-start: auto; font-size: 11px; opacity: .9; }
.locked-card { max-width: 640px; margin: 0 auto; text-align: center; }
.locked-card h2 { margin: 12px 0 8px; font-size: 22px; }
.locked-icon {
    width: 64px; height: 64px; margin: 0 auto; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-light, #fbefe0); color: var(--primary, #881337); font-size: 26px;
}
.locked-desc { font-size: 15px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; padding: 14px 16px 16px; }
.plan-card { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
.plan-card.plan-mine { border-color: var(--primary, #881337); box-shadow: 0 0 0 1px var(--primary, #881337) inset; }
.plan-name { font-weight: 700; font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.plan-card ul { margin: 0; padding-inline-start: 18px; font-size: 14px; line-height: 1.9; }
.plan-card li.plan-plus { list-style: none; margin-inline-start: -18px; font-weight: 600; color: var(--primary, #881337); }
html[data-theme="dark"] .plan-card { border-color: rgba(255,255,255,.14); }
