/* ============================================================================
   Notes list table — مرآة لجدول الطلبات/العملاء (نفس التصميم والترتيب والتأثير):
   شريط ملوّن حسب التصنيف + عمود رقم mono + رؤوس داكنة + صفوف قابلة للتوسيع.
   محصور بـ #notesPage. البادئة .nt-* خاصة بالملاحظات؛ عناصر التوسيع .ot-*
   مشتركة مع الطلبات والعملاء (أُعيد تعريفها هنا محصورة بصفحة الملاحظات كي
   تتغلّب على خصوصية قواعد الجدول الأساسية).
   ============================================================================ */

#notesPage .notes-table-wrapper {
    /* سطح صلب مطابق لجدول الطلبات/العملاء */
    background: var(--surface-solid);
    border: none;
    border-radius: var(--pane-radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 18px;
}

#notesPage .notes-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 760px;
}

/* ترويسة الجدول: مطابقة حرفياً لجدول الطلبات (خلفية فاتحة + حدّ سفلي رفيع). */
#notesPage .notes-table thead th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    background: var(--table-header-bg);
    padding: var(--table-header-padding);
    border-bottom: 1px solid var(--table-header-border);
    text-align: right;
    white-space: nowrap;
}

/* الصفوف: zebra + hover ناعم. مؤشّر التصنيف هو الشريط .nt-band في أول عمود. */
#notesPage .notes-table tbody tr {
    border-bottom: 1px solid var(--table-row-border);
    transition: background-color 0.18s ease;
    background-color: var(--table-row-solid);
}
#notesPage .notes-table tbody tr:nth-child(even) {
    background: var(--table-row-alt-bg, transparent);
}
#notesPage .notes-table tbody tr:last-child {
    border-bottom: none;
}
#notesPage .notes-table tbody tr:hover {
    background: var(--table-row-hover-bg);
}
#notesPage .notes-table tbody tr.clickable-row:hover {
    background: color-mix(in srgb, var(--primary) 4%, var(--table-row-hover-bg));
}

#notesPage .notes-table tbody td {
    padding: var(--table-cell-padding);
    text-align: right;
    color: var(--table-row-text, var(--text-main));
    vertical-align: middle;
    font-size: 13.5px;
    font-family: var(--app-font-family);
}

/* أول عمود بيانات: شريط ملوّن (nt-band) حسب التصنيف + رقم الصف بخط mono —
   مرآة order-id-cell / customer-id-cell (oc-band / cc-band). */
#notesPage .notes-table .note-id-cell {
    white-space: nowrap;
    vertical-align: middle;
    font-family: var(--app-mono-family);
    font-weight: 700;
    color: var(--text-title);
    padding-inline-start: 16px;
}
#notesPage .notes-table .nt-id-wrap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}
#notesPage .notes-table .nt-id-text {
    font-variant-numeric: tabular-nums;
}
#notesPage .notes-table .nt-band {
    display: inline-block;
    width: 4px;
    height: 18px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* عمود العنوان: مرآة customer-name-cell — قصّ ellipsis + أيقونة التثبيت */
#notesPage .notes-table .note-title-cell {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
#notesPage .notes-table .nt-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-weight: 700;
    color: var(--text-title);
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#notesPage .notes-table .nt-pin {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

/* عمود المحتوى: قصّ ellipsis */
#notesPage .notes-table .note-content-cell {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 12.5px;
}

/* شارة التصنيف — pill ناعمة */
#notesPage .notes-table .nt-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-title);
    white-space: nowrap;
}

/* التاريخ: ثانوي وصغير */
#notesPage .notes-table .note-date {
    color: var(--text-secondary);
    font-size: 11.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* === تكيف الوضع الليلي === */
body.dark-mode #notesPage .notes-table-wrapper {
    background: var(--surface-main);
}

/* === تجاوب الجوال === */
@media (max-width: 768px) {
    #notesPage .notes-table {
        font-size: 12px;
        min-width: 640px;
    }
    /* الترويسة لا تتقلّص على الجوال — تبقى بحجم واجهة الطلبات الثابت. */
    #notesPage .notes-table tbody td {
        padding: 10px 8px;
    }
}

/* ============================================================================
   عرض القائمة — صفوف قابلة للتوسيع (مرآة design-5 في الطلبات/العملاء)
   مطابق تماماً: زر دائري يدور، تثبيت بصري للصف المفتوح، شبكة تفاصيل + إجراءات.
   ============================================================================ */
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle-th {
    width: 48px;
    padding: 0;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle-cell {
    width: 48px;
    padding-inline-start: 14px;
    padding-inline-end: 4px;
    text-align: center;
    vertical-align: middle;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-main);
    background: var(--surface-solid);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition:
        color 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle:hover,
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle:focus-visible {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-solid));
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 38%, transparent);
    outline: none;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle svg {
    transition: transform 0.2s ease;
}
/* السهم يدور للأسفل عند الفتح */
#notesPage .notes-table-wrapper.ot-expandable .ot-main.is-open .ot-toggle svg,
#notesPage .notes-table-wrapper.ot-expandable .ot-toggle.is-open svg {
    transform: rotate(90deg);
}
#notesPage .notes-table-wrapper.ot-expandable .ot-main.is-open .ot-toggle {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 38%, transparent);
}

/* تثبيت بصري للصف المفتوح */
#notesPage .notes-table-wrapper.ot-expandable .ot-main.is-open {
    background: color-mix(in srgb, var(--primary) 6%, var(--surface-solid));
}
#notesPage .notes-table-wrapper.ot-expandable .ot-main.is-open:hover {
    background: color-mix(in srgb, var(--primary) 9%, var(--surface-solid));
}

/* صف التفاصيل: مطوي افتراضياً، يُكشف بإضافة .is-open */
#notesPage .notes-table-wrapper.ot-expandable .ot-detail {
    display: none;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-detail.is-open {
    display: table-row;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-detail > td {
    padding: 0 !important;
    border-bottom: 1px solid var(--table-row-border);
    background: var(--surface-alt, color-mix(in srgb, var(--primary) 3%, var(--surface-solid)));
}
#notesPage .notes-table-wrapper.ot-expandable .ot-detail-inner {
    padding: 16px 18px 18px;
    animation: otDetailIn 0.18s ease-out;
}
@media (prefers-reduced-motion: reduce) {
    #notesPage .notes-table-wrapper.ot-expandable .ot-detail-inner {
        animation: none;
    }
    #notesPage .notes-table-wrapper.ot-expandable .ot-toggle svg {
        transition: none;
    }
}

/* المحتوى الكامل داخل التفاصيل */
#notesPage .notes-table-wrapper.ot-expandable .nt-detail-content {
    font-size: 13px;
    color: var(--text-main);
    white-space: pre-wrap;
    line-height: 1.7;
    margin-bottom: 14px;
}

/* شبكة التفاصيل: تسمية/قيمة */
#notesPage .notes-table-wrapper.ot-expandable .ot-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px 22px;
    margin-bottom: 14px;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-dt-item {
    min-width: 0;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-dt-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
    letter-spacing: 0.2px;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-dt-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    line-height: 1.5;
}
#notesPage .notes-table-wrapper.ot-expandable .ot-dt-val > .ot-dt-sub {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* الإجراءات داخل التفاصيل */
#notesPage .notes-table-wrapper.ot-expandable .ot-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--table-row-border);
}

/* === استجابة الجوال === */
@media (max-width: 540px) {
    #notesPage .notes-table-wrapper.ot-expandable .ot-detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    #notesPage .notes-table-wrapper.ot-expandable .ot-detail-actions {
        gap: 6px;
    }
}
@media (max-width: 768px) {
    #notesPage .notes-table-wrapper.ot-expandable .ot-detail-inner {
        padding: 14px;
    }
}

/* ============================================================================
   شريط أدوات الملاحظات الموحّد (.notes-toolbar-v2) — مرآة تامّ لصفحة الطلبات:
   حاوية شفافة بلا بطاقة، عناصر التحكم (بحث Dock/زر الفلترة/قائمة العرض) تطفو
   مباشرةً على خلفية الصفحة. الأصناف .ot-* محصورة هنا بـ #notesPage.
   ============================================================================ */
#notesPage .notes-toolbar-v2 {
    /* المسافة بين الشريط والمحتوى موحّدة عبر فجوة ‎.page المرنة (18px) في كل
        الصفحات — لا هامش إضافياً هنا كي لا تتضاعف المسافة (كانت 16+18). */
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}
#notesPage .ot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== بحث «Dock»: دائرة مطويّة تتوسّع لحقل، وتطوى عند فقدان التركيز بنص فارغ. ===== */
#notesPage .ot-search {
    flex: 1 1 320px;
    min-width: 280px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px 0 14px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border: 1px solid var(--border-main);
    border-radius: 10px;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}
#notesPage .ot-search:hover,
#notesPage .ot-search:focus-within {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border-color: var(--border-main);
}
#notesPage .ot-search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex: 0 0 18px;
}
#notesPage .ot-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--text-title);
    padding: 0;
}
#notesPage .ot-search input::placeholder {
    color: var(--text-secondary);
}
/* الحالة المطوية: دائرة كاملة */
#notesPage .ot-search[data-collapsed='true'] {
    flex: 0 0 42px;
    min-width: 42px;
    width: 42px;
    padding: 0;
    gap: 0;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    border-radius: 999px;
    transition:
        flex-basis 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        min-width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        padding 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-radius 0.25s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#notesPage .ot-search[data-collapsed='true']:hover {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border-color: var(--border-main);
    color: var(--text-title);
}
#notesPage .ot-search .ot-search-trigger {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}
#notesPage .ot-search[data-collapsed='false'] .ot-search-trigger {
    pointer-events: none;
}
#notesPage .ot-search[data-collapsed='true'] #notesSearchInput {
    width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}
/* الحالة الموسّعة: حقل بِلّي */
#notesPage .ot-search[data-collapsed='false'] {
    flex: 0 0 300px;
    min-width: 260px;
    max-width: 360px;
    width: auto;
    padding: 0 16px 0 18px;
    justify-content: flex-start;
    cursor: text;
    border-radius: 999px;
    transition:
        flex-basis 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        min-width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        padding 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-radius 0.25s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#notesPage .ot-search[data-collapsed='false'] #notesSearchInput {
    width: auto;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.25s ease 0.1s;
}
#notesPage .ot-search .ot-search-icon {
    transition: transform 0.25s ease;
}
/* زر الإغلاق (X) في الحالة الموسّعة فقط */
#notesPage .ot-search .ot-search-clear {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 26px;
    padding: 0;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}
#notesPage .ot-search .ot-search-clear svg {
    width: 14px;
    height: 14px;
}
#notesPage .ot-search .ot-search-clear:hover {
    background: color-mix(in srgb, var(--text-title) 8%, transparent);
    color: var(--text-title);
}
#notesPage .ot-search .ot-search-clear:active {
    transform: scale(0.92);
}
#notesPage .ot-search[data-collapsed='false'] .ot-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}
#notesPage .ot-search[data-collapsed='false'] .ot-search-clear.is-visible {
    display: inline-flex;
}
@media (prefers-reduced-motion: reduce) {
    #notesPage .ot-search,
    #notesPage .ot-search[data-collapsed='true'],
    #notesPage .ot-search[data-collapsed='false'],
    #notesPage .ot-search .ot-search-icon,
    #notesPage .ot-search #notesSearchInput {
        transition: none !important;
    }
}

/* ===== أزرار الأدوات (.ot-btn) ===== */
#notesPage .ot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border-main);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    color: var(--text-title);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
    white-space: nowrap;
}
#notesPage .ot-btn:hover {
    background: var(--nav-bg-hover, #ecf2ff);
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
}
#notesPage .ot-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#notesPage .ot-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex: 0 0 16px;
}
#notesPage .ot-btn[aria-expanded='true'] {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-main));
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
    color: var(--primary);
}
#notesPage .ot-btn-filter .ot-badge {
    position: absolute;
    inset-inline-end: -4px;
    inset-block-start: -4px;
}
#notesPage .ot-btn {
    position: relative;
}
#notesPage .ot-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    font-family: var(--app-mono-family);
}}
/* display:inline-flex أعلاه يطغى على [hidden] الافتراضي — بدونه تبقى شارة
   «0» ظاهرة رغم ضبط JS للسمة. الصفر لا شارة له إطلاقاً (مرآة الطلبات). */
#notesPage .ot-badge[hidden] {
    display: none !important;
}
/* وهن احتياط: شارة بلا نصّ لا تُرسم إطلاقاً حتى لو فُقدت hidden */
#notesPage .ot-badge:empty {
    display: none !important;
}

#notesPage .ot-btn[aria-expanded='true'] .ot-badge {
    background: var(--primary-hover, var(--primary));
}

/* ===== قائمة العرض (.ot-view-wrap) ===== */
#notesPage .ot-view-wrap {
    position: relative;
}
#notesPage .ot-view-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    min-width: 168px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border: 1px solid var(--border-main);
    border-radius: 999px;
    color: var(--text-title);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#notesPage .ot-view-trigger:hover {
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
}
#notesPage .ot-view-trigger[aria-expanded='true'] {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
#notesPage .ot-view-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#notesPage .ot-view-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#notesPage .ot-view-left svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    stroke-width: 2;
    flex: 0 0 16px;
}
/* ================================================================
   ترويسة التابات الممدّدة (xtabs) — نسخة من ترويسة الطلبات v2
   (orders-cards.css §xtabs) مقيّدة بـ #notesPage: مجموعة البحث + الفترة +
   زر الفلترة (يمين)، ومجموعة طريقة العرض قائمة/بطاقات (يسار).
   ================================================================ */
#notesPage .xtabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-main);
    background: var(--surface-main);
    border-radius: 16px;
    padding: 4px;
    box-shadow: var(--shadow-sm);
    width: fit-content;
    max-width: 100%;
}
#notesPage .xtab {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 7px;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 999px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        padding 0.45s cubic-bezier(0.32, 0.72, 0, 1),
        box-shadow 0.3s ease;
    white-space: nowrap;
    position: relative;
}
/* أيقونات أرقّ من عتبة 2 الافتراضية — مرآة الطلبات */
#notesPage .xtab svg {
    flex: none;
    width: 16px;
    height: 16px;
    stroke-width: 1.7;
}
#notesPage .xtab:hover {
    background: var(--nav-bg-hover, var(--surface-hover));
    color: var(--text-title);
}
#notesPage .xtab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}
/* التسمية مطوية (عرض صفر) إلا في التاب الممدّد — قلب مكوّن ExpandableTabs */
#notesPage .xtab .xtab-label {
    display: inline-block;
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition:
        width 0.5s cubic-bezier(0.32, 0.72, 0, 1) 0.05s,
        opacity 0.3s ease 0.1s;
}
#notesPage .xtab[aria-pressed='true'] {
    background: var(--surface-hover);
    color: var(--primary);
    padding: 7px 13px;
    gap: 7px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
#notesPage .xtab[aria-pressed='true'] .xtab-label {
    width: auto;
    opacity: 1;
}
#notesPage .xsep {
    width: 1.2px;
    height: 22px;
    background: var(--border-main);
    margin: 0 4px;
    flex: none;
}
#notesPage .xsep[hidden] {
    display: none;
}
/* شريط التحكم بشقّين: مجموعة يمنى (بحث+فترة+فلترة) وفاصل مرن ومجموعة يسرى (عرض) */
#notesPage .xcontrols {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
#notesPage .xspacer {
    flex: 1;
}
/* --- البحث (dock) داخل المجموعة: يذوب في وعاء .xtabs — مطويّ كأيقونة صامتة
   بنفس مقاس التاب، وممدّد كحقل محدَّد بحدّ ظاهر (مرآة الطلبات) --- */
#notesPage .xtabs .ot-search {
    flex: 0 1 auto;
    min-width: 0;
    height: 32px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
#notesPage .xtabs .ot-search[data-collapsed='true'] {
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    padding: 0;
    gap: 0;
    justify-content: center;
}
#notesPage .xtabs .ot-search[data-collapsed='true']:hover {
    background: var(--nav-bg-hover, var(--surface-hover));
    border-color: transparent;
}
#notesPage .xtabs .ot-search[data-collapsed='false'] {
    flex: 0 1 230px;
    min-width: 170px;
    max-width: 300px;
    padding: 0 12px;
    background: var(--surface-main);
    border-color: var(--border-main);
}

/* --- زرّ الفلترة كأيقونة تاب: نلغي التنسيق الدائري المستقل --- */
#notesPage .xtabs .ot-btn {
    height: auto;
    min-width: 0;
    width: auto;
    flex: 0 0 auto;
    padding: 7px;
    gap: 0;
    border: 0;
    background: transparent;
    border-radius: 999px;
    box-shadow: none;
    font-size: 0.8125rem;
    font-weight: 500;
}
#notesPage .xtabs .ot-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.7;
    color: var(--text-secondary);
}
#notesPage .xtabs .ot-btn:hover {
    background: var(--nav-bg-hover, var(--surface-hover));
    border-color: transparent;
    color: var(--text-title);
}
#notesPage .xtabs .ot-btn svg {
    color: inherit;
}
/* الحالة المفتوحة (popover): صبغة أساسية خفيفة كالتاب الممدّد */
#notesPage .xtabs .ot-btn[aria-expanded='true'] {
    background: var(--surface-hover);
    border-color: transparent;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
#notesPage .xtabs .ot-btn[aria-expanded='true'] svg {
    color: var(--primary);
}
/* شارة عدّاد الفلاتر خارج جسم الأيقونة بزاوية سفلية بعيدة — بحلقة سطح */
#notesPage .xtabs .ot-btn-filter {
    position: relative;
}
#notesPage .xtabs .ot-btn-filter .ot-badge {
    position: absolute;
    bottom: auto;
    inset-inline-end: auto;
    top: -8px;
    inset-inline-start: -10px;
    box-shadow:
        0 0 0 2px var(--surface-main),
        0 2px 6px color-mix(in srgb, var(--text-title) 18%, transparent);
}
/* وفي الفلاتر النشطة: الزر بوهج «المضغوط» نفسه (مرآة الطلبات) */
#notesPage .xtabs .ot-btn-filter.is-active {
    background: var(--surface-hover);
    color: var(--primary);
}
/* بنود قائمة الكثافة بنمط بنود الأعمدة نفسه (مرآة الطلبات) */
#notesPage .ot-density-menu .ot-view-item {
    padding: 7px 10px;
    gap: 8px;
    font-size: 12.5px;
    border-radius: 7px;
}

/* --- الجوال: صفّ واحد قابل للسحب لكل شريط (مرآة الطلبات) --- */
@media (max-width: 720px) {
    #notesPage .xtabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        width: 100%;
        padding: 3px;
        gap: 2px;
    }
    #notesPage .xtabs::-webkit-scrollbar {
        display: none;
    }
    #notesPage .xtab {
        padding: 5px;
        font-size: 0.75rem;
        scroll-snap-align: start;
    }
    #notesPage .xtab svg {
        width: 15px;
        height: 15px;
    }
    #notesPage .xtab[aria-pressed='true'] {
        padding: 5px 10px;
        gap: 6px;
    }
    #notesPage .xsep {
        height: 18px;
        margin: 0 2px;
    }
    #notesPage .xtabs .ot-btn {
        padding: 5px;
    }
    #notesPage .xtabs .ot-btn svg {
        width: 15px;
        height: 15px;
    }
    #notesPage .xtabs .ot-search {
        height: 27px;
    }
    #notesPage .xtabs .ot-search[data-collapsed='true'] {
        flex: 0 0 27px;
        width: 27px;
        min-width: 27px;
    }
    #notesPage .xtabs .ot-search[data-collapsed='false'] {
        flex: 1 1 100%;
        min-width: 140px;
    }
    #notesPage .xcontrols {
        flex-wrap: nowrap;
        align-items: center;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    #notesPage .xcontrols::-webkit-scrollbar {
        display: none;
    }
    #notesPage .xcontrols [data-xtgroup='mainN'] {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
    }
    #notesPage .xcontrols [data-xtgroup='viewN'] {
        flex: 0 0 auto;
        width: auto;
        margin-inline-start: auto;
    }
    /* حين يتمدّد البحث تُخفى مجموعة العرض مؤقتاً ليتنفس الحقل */
    #notesPage .xcontrols:has(.ot-search[data-collapsed='false']) [data-xtgroup='viewN'] {
        display: none;
    }
    #notesPage .xspacer {
        display: none;
    }
}

/* احترام تفضيل تقليل الحركة: تمدّد التسمية فوري بلا انتقال */
@media (prefers-reduced-motion: reduce) {
    #notesPage .xtab,
    #notesPage .xtab .xtab-label {
        transition: none;
    }
}

/* قائمة العرض/الأعمدة (.ot-view-menu) ومحتواها مُعرَّفة عامة (تُنقل لـ <body>
   عند الفتح) في orders-cards.css/customers.css — لا نكرّرها هنا. */

/* ===== شريط الفلاتر النشطة (chips) ===== */
#notesPage .ot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid var(--border-light);
    margin-top: 6px;
    background: var(--surface-hover);
    border-radius: 0 0 10px 10px;
}
#notesPage .ot-chips:empty {
    display: none;
}
#notesPage .ot-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 4px 0 12px;
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-main));
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border-main));
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 8%, transparent);
}
#notesPage .ot-chip-label {
    color: color-mix(in srgb, var(--primary) 60%, var(--text-secondary));
    font-weight: 500;
    margin-inline-end: 2px;
}
#notesPage .ot-chip button {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}
#notesPage .ot-chip button:hover {
    background: var(--primary);
    color: #fff;
    transform: rotate(90deg);
}
#notesPage .ot-chip button svg {
    width: 10px;
    height: 10px;
    stroke-width: 2.5;
}

/* ===== popover فلتر التصنيف: شارة العدّاد بجانب كل خيار ===== */
/* عامّ (القائمة تُنقل لـ <body> عند الفتح) */
.ot-view-menu .ot-tag-count {
    margin-inline-start: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--text-title) 8%, transparent);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--app-mono-family);
}
.ot-view-menu .ot-view-item.active .ot-tag-count {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    color: var(--primary);
}
.nt-filter-popover {
    max-height: 360px;
    overflow-y: auto;
}
/* إخفاء علامة الصحّ (layout) على الخيارات غير النشطة كي يجلس شارة العدّاد لازقاً
   بالحافة؛ الخيار النشط يُظهرها فتظهر بين التسمية والعدّاد. */
.nt-filter-popover .ot-view-item:not(.active) .ot-view-check {
    display: none;
}
/* إزاحة شارة العدّاد قبل علامة الصحّ (التي تأخذ margin-inline-start:auto أيضاً) */
.ot-view-menu .ot-view-item .ot-tag-count + .ot-view-check {
    margin-inline-start: 6px;
}

/* ===== الكثافة: مضغوط يقلّل بطانة خلايا البيانات فقط (مرآة ot-density-compact)
   — الترويسة ثابتة دائماً بحجم الافتراضي كجدول الطلبات. ===== */
#notesPage .nt-density-compact .notes-table tbody td {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 12.5px;
}

/* ===== تجاوب الجوال ===== */
@media (max-width: 540px) {
    #notesPage .ot-row {
        gap: 8px;
    }
    #notesPage .ot-view-trigger {
        min-width: 0;
    }
}

/* ============================================================================
   بطاقة الملاحظة «Bold Colorful» (.nc-*) — مرآة تامّة لـ .oc-card في الطلبات:
   شريط هالة بلون التصنيف عند المرور + ركن واحد كبير غير متوقّع + chip تصنيف بنقطة
   + جسم محتوى محصور + صفوف عميل/حملة بأيقونات + تذييل بتواريخ وأزرار إجراء.
   كل العناصر تستخدم --nc-band (لون شريط التصنيف) فتتلوّن حسب فئة الملاحظة
   وتتكيّف مع الوضع الليلي والثيم القابل للتخصيص. محصور بـ #notesPage.
   ============================================================================ */
/* الشبكة: كثافة مطابقة لـ .oc-grid (أعمدة أضيق + فجوة أصغر) */
#notesPage #notesGrid.orders-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

#notesPage .nc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface-solid);
    border: none;
    --nc-r-big: 40px;
    --nc-r: 16px;
    border-start-end-radius: var(--nc-r-big);
    border-start-start-radius: var(--nc-r);
    border-end-start-radius: var(--nc-r);
    border-end-end-radius: var(--nc-r);
    padding: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.22s ease;
}
#notesPage .nc-card:hover {
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px color-mix(in srgb, var(--nc-band, var(--primary)) 32%, transparent),
        0 18px 40px -14px color-mix(in srgb, var(--nc-band, var(--primary)) 48%, transparent);
}
@media (prefers-reduced-motion: reduce) {
    #notesPage .nc-card {
        transition: none;
    }
}

/* الرأس: شارة التثبيت + العنوان + chip التصنيف */
#notesPage .nc-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-inline-start: 10px;
    min-width: 0;
}
#notesPage .nc-pin {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--nc-band, var(--primary)) 16%, var(--surface-solid));
    color: var(--nc-band, var(--primary));
}
#notesPage .nc-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#notesPage .nc-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-inline-start: auto;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    color: var(--text-title);
    background: color-mix(in srgb, var(--nc-band, var(--primary)) 24%, var(--surface-solid));
    white-space: nowrap;
}
#notesPage .nc-chip::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--nc-band, var(--primary));
}

/* جسم المحتوى: صندوق ناعم + نقطة بلون التصنيف + قصّ ٣ أسطر */
#notesPage .nc-body {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 10px;
    padding: 9px 11px;
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}
#notesPage .nc-body .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--nc-band, var(--primary));
    margin-top: 6px;
    flex-shrink: 0;
}
#notesPage .nc-body p {
    margin: 0;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* صفوف العميل/الحملة */
#notesPage .nc-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    padding-inline-start: 10px;
}
#notesPage .nc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-main);
    min-width: 0;
}
#notesPage .nc-row .ico {
    width: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
#notesPage .nc-row .value {
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* التذييل: تواريخ + أزرار إجراء (يدفع للأسفل كـ .oc-foot) */
#notesPage .nc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-main);
}
#notesPage .nc-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
#notesPage .nc-meta .lbl {
    color: var(--text-muted);
    font-weight: 600;
    margin-inline-end: 2px;
}
#notesPage .nc-meta-sep {
    color: var(--text-muted);
}

#notesPage .nc-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#notesPage .nc-act {
    width: 30px;
    height: 30px;
    min-width: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-main);
    background: var(--surface-solid);
    color: var(--text-secondary);
    border-radius: 999px;
    cursor: pointer;
    padding: 0;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}
#notesPage .nc-act:hover {
    background: color-mix(in srgb, var(--primary) 12%, var(--surface-solid));
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
}
#notesPage .nc-act.nc-act-danger:hover {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface-solid));
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 38%, var(--border-main));
}
#notesPage .nc-act:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    #notesPage .nc-act {
        transition: none;
    }
}

/* الكثافة المضغوطة: حشو وحواف أقلّ */
#notesPage .nt-density-compact .nc-card {
    padding: 12px;
}
#notesPage .nt-density-compact .nc-card .nc-top,
#notesPage .nt-density-compact .nc-card .nc-rows {
    margin-bottom: 8px;
}

/* الجوال: عمود واحد + ركن كبير أصغر */
@media (max-width: 540px) {
    #notesPage #notesGrid.orders-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #notesPage .nc-card {
        --nc-r-big: 28px;
        padding: 14px;
    }
}
