/* ──────────────────────────────────────────────
   نظام أروى للصناعة والبلاستيك — قسم PET
   هوية بصرية: أزرق ملكي (Royal Blue) + نحاسي (Brass) — مطابق لشعار أروى
   مطابق لـ Next.js shadcn/ui الأصلي — مكتوب بـ CSS أصلي لووردبريس
   ────────────────────────────────────────────── */

:root {
        /* الألوان — أزرق */
        --petrol-50: #eff6ff;
        --petrol-100: #dbeafe;
        --petrol-200: #bfdbfe;
        --petrol-300: #93c5fd;
        --petrol-400: #60a5fa;
        --petrol-500: #3b82f6;
        --petrol-600: #2563eb;
        --petrol-700: #1d4ed8;
        --petrol-800: #1e40af;
        --petrol-900: #1e3a8a;
        --petrol-950: #172554;
        /* الألوان — نحاسي */
        --brass-100: #fdf1d8;
        --brass-200: #fbe3b1;
        --brass-300: #f8d488;
        --brass-400: #f5c05a;
        --brass-500: #f5b942;
        --brass-600: #d99a26;
        --brass-700: #b57d1c;
        /* متغيرات shadcn */
        --background: #f0f6ff;
        --foreground: #1f2937;
        --card: #ffffff;
        --card-foreground: #1f2937;
        --primary: #1e3a8a;
        --primary-foreground: #ffffff;
        --secondary: #eff6ff;
        --secondary-foreground: #1e3a8a;
        --muted: #eff6ff;
        --muted-foreground: #475569;
        --accent: #eff6ff;
        --accent-foreground: #1e3a8a;
        --destructive: #dc2626;
        --destructive-foreground: #ffffff;
        --border: #dbeafe;
        --input: #bfdbfe;
        --ring: #3b82f6;
        --sidebar-bg: #1e3a8a;
        --sidebar-fg: #dbeafe;
        --sidebar-active: #f5b942;
        --radius: 0.625rem;
        --shadow-card: 0 1px 3px rgba(13, 59, 62, 0.08), 0 1px 2px rgba(13, 59, 62, 0.04);
        --shadow-md: 0 4px 6px -1px rgba(13, 59, 62, 0.08), 0 2px 4px -2px rgba(13, 59, 62, 0.06);
        --shadow-lg: 0 10px 15px -3px rgba(13, 59, 62, 0.1), 0 4px 6px -4px rgba(13, 59, 62, 0.05);
}

* { box-sizing: border-box; }

html {
        font-family: "Tajawal", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
        -webkit-text-size-adjust: 100%;
}

body {
        margin: 0;
        background: var(--background);
        color: var(--foreground);
        font-family: "Tajawal", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
        font-size: 14px;
        line-height: 1.6;
        direction: rtl;
}

/* الأرقام الجدولية */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ──────────────────────────────────────────────
   التخطيط العام — Sticky Footer
   ────────────────────────────────────────────── */
.arwa-app {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background: linear-gradient(180deg, #dbeafe 0%, transparent 260px);
}

.arwa-main {
        flex: 1;
        width: 100%;
        max-width: 1280px;
        margin: 0 auto;
        padding: 16px;
}

@media (min-width: 640px) {
        .arwa-main { padding: 24px; }
}

/* ──────────────────────────────────────────────
   الرأس
   ────────────────────────────────────────────── */
.arwa-header {
        background: var(--petrol-900);
        color: #fff;
        box-shadow: var(--shadow-md);
        position: sticky;
        top: 0;
        z-index: 40;
}

.arwa-header-inner {
        max-width: 1280px;
        margin: 0 auto;
        padding: 12px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: wrap;
}

.arwa-brand {
        display: flex;
        align-items: center;
        gap: 12px;
}

.arwa-brand-logo {
        width: 48px;
        height: 48px;
        background: var(--brass-500);
        border-radius: 12px;
        display: grid;
        place-items: center;
        color: var(--petrol-950);
        font-weight: 900;
        font-size: 20px;
        box-shadow: var(--shadow-md);
}

.arwa-brand-text {
        display: flex;
        flex-direction: column;
        line-height: 1.3;
}

.arwa-brand-name {
        font-weight: 800;
        font-size: 16px;
        color: #fff;
}

.arwa-brand-sub {
        font-size: 11px;
        color: var(--petrol-200);
}

.arwa-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
}

.arwa-user-chip {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
        background: var(--petrol-800);
        border-radius: 999px;
        border: 1px solid var(--petrol-700);
        color: #fff;
        font-size: 13px;
        font-weight: 600;
}

.arwa-user-chip-name { font-weight: 700; }
.arwa-user-chip-role { color: var(--brass-300); font-size: 11px; }

.arwa-icon-btn {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        background: var(--petrol-800);
        border: 1px solid var(--petrol-700);
        border-radius: 12px;
        color: #fff;
        cursor: pointer;
        transition: background 0.15s;
        position: relative;
}

.arwa-icon-btn:hover { background: var(--petrol-700); }

.arwa-icon-btn-badge {
        position: absolute;
        top: -4px;
        left: -4px;
        background: var(--brass-500);
        color: var(--petrol-950);
        font-size: 10px;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 999px;
        display: grid;
        place-items: center;
}

/* ──────────────────────────────────────────────
   الشريط الجانبي (Desktop) + تبويبات (Mobile)
   ────────────────────────────────────────────── */
.arwa-layout {
        display: flex;
        flex: 1;
        flex-direction: column;
        width: 100%;
}

@media (min-width: 1024px) {
        .arwa-layout { flex-direction: row; }
}

.arwa-sidebar {
        background: var(--sidebar-bg);
        color: var(--sidebar-fg);
        width: 100%;
}

@media (min-width: 1024px) {
        .arwa-sidebar {
                width: 260px;
                min-height: calc(100vh - 73px);
                position: sticky;
                top: 73px;
        }
}

.arwa-sidebar-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding: 8px;
        list-style: none;
        margin: 0;
}

@media (min-width: 1024px) {
        .arwa-sidebar-list { flex-direction: column; }
}

.arwa-sidebar-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border-radius: 10px;
        color: var(--petrol-200);
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        transition: all 0.15s;
        cursor: pointer;
        border: none;
        background: transparent;
        width: 100%;
        text-align: right;
        font-family: inherit;
}

.arwa-sidebar-link:hover {
        background: var(--petrol-800);
        color: #fff;
}

.arwa-sidebar-link.is-active {
        background: var(--brass-500);
        color: var(--petrol-950);
        font-weight: 800;
}

.arwa-sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ──────────────────────────────────────────────
   الإصلاح v1.2.1 — منع تضخّم الأيقونات
   السبب: SVG بلا width/height داخل .arwa-card-title
   كان يتمدد لملء عرض المحتوى بالكامل
   ────────────────────────────────────────────── */

/* عناوين البطاقات: flex لمحاذاة الأيقونة مع النص + قيد صريح لحجم الأيقونة */
.arwa-card-title {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
}

.arwa-card-title svg,
.arwa-card-title img {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
}

/* شبكة أمان عامة: أي SVG داخل التطبيق لا يتجاوز حجماً معقولاً
   حتى لو أُدرج مستقبلاً في حاوية بلا قاعدة CSS خاصة */
.arwa-app svg:not(.arwa-chart-svg) {
        max-width: 32px;
        max-height: 32px;
}

/* ──────────────────────────────────────────────
   البطاقات
   ────────────────────────────────────────────── */
.arwa-card {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-card);
        padding: 20px;
        margin-bottom: 16px;
}

.arwa-card-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--petrol-900);
        margin: 0 0 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
}

.arwa-card-grid {
        display: grid;
        gap: 16px;
        grid-template-columns: 1fr;
}

@media (min-width: 768px) {
        .arwa-card-grid-2 { grid-template-columns: repeat(2, 1fr); }
        .arwa-card-grid-3 { grid-template-columns: repeat(3, 1fr); }
        .arwa-card-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* KPI Cards */
.arwa-kpi {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 6px;
}

.arwa-kpi-label {
        font-size: 12px;
        color: var(--muted-foreground);
        font-weight: 600;
}

.arwa-kpi-value {
        font-size: 24px;
        font-weight: 800;
        color: var(--petrol-900);
        font-variant-numeric: tabular-nums;
}

.arwa-kpi-sub {
        font-size: 11px;
        color: var(--muted-foreground);
}

.arwa-kpi.is-petrol {
        background: var(--petrol-900);
        color: #fff;
}
.arwa-kpi.is-petrol .arwa-kpi-label { color: var(--petrol-200); }
.arwa-kpi.is-petrol .arwa-kpi-value { color: #fff; }
.arwa-kpi.is-petrol .arwa-kpi-sub { color: var(--petrol-300); }

.arwa-kpi.is-brass {
        background: var(--brass-500);
        color: var(--petrol-950);
}
.arwa-kpi.is-brass .arwa-kpi-label { color: var(--petrol-900); }
.arwa-kpi.is-brass .arwa-kpi-value { color: var(--petrol-950); }

/* ──────────────────────────────────────────────
   الأزرار
   ────────────────────────────────────────────── */
.arwa-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 16px;
        border-radius: 8px;
        border: 1px solid transparent;
        background: var(--primary);
        color: var(--primary-foreground);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s;
        font-family: inherit;
        text-decoration: none;
        white-space: nowrap;
}

.arwa-btn:hover { background: var(--petrol-800); }
.arwa-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.arwa-btn-secondary {
        background: var(--secondary);
        color: var(--secondary-foreground);
        border-color: var(--border);
}
.arwa-btn-secondary:hover { background: var(--petrol-100); }

.arwa-btn-brass {
        background: var(--brass-500);
        color: var(--petrol-950);
}
.arwa-btn-brass:hover { background: var(--brass-600); }

.arwa-btn-danger {
        background: var(--destructive);
        color: #fff;
}
.arwa-btn-danger:hover { background: #b91c1c; }

.arwa-btn-ghost {
        background: transparent;
        color: var(--petrol-700);
}
.arwa-btn-ghost:hover { background: var(--petrol-50); }

.arwa-btn-sm { padding: 4px 10px; font-size: 12px; }
.arwa-btn-lg { padding: 12px 24px; font-size: 16px; }

.arwa-btn svg { width: 16px; height: 16px; }

/* ──────────────────────────────────────────────
   النماذج
   ────────────────────────────────────────────── */
.arwa-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 12px;
}

.arwa-label {
        font-size: 13px;
        font-weight: 600;
        color: var(--petrol-800);
}

.arwa-label .req { color: var(--destructive); margin-inline-start: 2px; }

.arwa-input,
.arwa-select,
.arwa-textarea {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid var(--input);
        border-radius: 8px;
        background: #fff;
        color: var(--foreground);
        font-size: 14px;
        font-family: inherit;
        transition: border-color 0.15s, box-shadow 0.15s;
}

.arwa-input:focus,
.arwa-select:focus,
.arwa-textarea:focus {
        outline: none;
        border-color: var(--petrol-500);
        box-shadow: 0 0 0 3px rgba(53, 125, 123, 0.15);
}

.arwa-input.is-error { border-color: var(--destructive); }

.arwa-hint { font-size: 11px; color: var(--muted-foreground); }
.arwa-error { font-size: 11px; color: var(--destructive); }

.arwa-form-row {
        display: grid;
        gap: 12px;
        grid-template-columns: 1fr;
}

@media (min-width: 640px) {
        .arwa-form-row-2 { grid-template-columns: repeat(2, 1fr); }
        .arwa-form-row-3 { grid-template-columns: repeat(3, 1fr); }
        .arwa-form-row-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ──────────────────────────────────────────────
   الجداول
   ────────────────────────────────────────────── */
.arwa-table-wrap {
        overflow-x: auto;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: #fff;
}

.arwa-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
}

.arwa-table th,
.arwa-table td {
        padding: 10px 12px;
        text-align: right;
        border-bottom: 1px solid var(--border);
}

.arwa-table th {
        background: var(--petrol-50);
        color: var(--petrol-800);
        font-weight: 700;
        font-size: 12px;
        white-space: nowrap;
}

.arwa-table tbody tr:hover { background: var(--petrol-50); }

.arwa-table tfoot th,
.arwa-table tfoot td {
        background: var(--petrol-100);
        font-weight: 700;
}

.arwa-table .num { font-variant-numeric: tabular-nums; text-align: center; }
.arwa-table .center { text-align: center; }

/* ──────────────────────────────────────────────
   الشارات
   ────────────────────────────────────────────── */
.arwa-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
}

.arwa-badge-pending { background: #fef3c7; color: #92400e; }
.arwa-badge-approved { background: #d1fae5; color: #065f46; }
.arwa-badge-rejected { background: #fee2e2; color: #991b1b; }
.arwa-badge-partial { background: #dbeafe; color: #1e40af; }
.arwa-badge-draft { background: #f3f4f6; color: #374151; }
.arwa-badge-submitted { background: #d1fae5; color: #065f46; }
.arwa-badge-open { background: #fee2e2; color: #991b1b; }
.arwa-badge-progress { background: #fef3c7; color: #92400e; }
.arwa-badge-resolved { background: #d1fae5; color: #065f46; }
.arwa-badge-closed { background: #e0e7ff; color: #3730a3; }
.arwa-badge-escalated { background: #fed7aa; color: #9a3412; }
.arwa-badge-qa { background: #dbeafe; color: #1e40af; }

.arwa-badge-minor { background: #d1fae5; color: #065f46; }
.arwa-badge-medium { background: #fef3c7; color: #92400e; }
.arwa-badge-critical { background: #fee2e2; color: #991b1b; }

/* ──────────────────────────────────────────────
   التبويبات
   ────────────────────────────────────────────── */
.arwa-tabs-list {
        display: flex;
        gap: 4px;
        padding: 4px;
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid var(--petrol-100);
        border-radius: 12px;
        overflow-x: auto;
        margin-bottom: 12px;
        backdrop-filter: blur(8px);
}

.arwa-tab {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        border-radius: 8px;
        border: none;
        background: transparent;
        color: var(--petrol-700);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        font-family: inherit;
        transition: all 0.15s;
}

.arwa-tab:hover { background: var(--petrol-50); }

.arwa-tab.is-active {
        background: var(--brass-500);
        color: var(--petrol-950);
        font-weight: 800;
}

.arwa-tab svg { width: 16px; height: 16px; }

/* ──────────────────────────────────────────────
   شاشة تسجيل الدخول
   ────────────────────────────────────────────── */
.arwa-login-page {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: linear-gradient(135deg, var(--petrol-900) 0%, var(--petrol-700) 100%);
        padding: 20px;
}

.arwa-login-card {
        background: #fff;
        border-radius: 16px;
        padding: 40px 32px;
        width: 100%;
        max-width: 420px;
        box-shadow: var(--shadow-lg);
}

.arwa-login-logo {
        width: 80px;
        height: 80px;
        background: var(--petrol-900);
        border-radius: 20px;
        margin: 0 auto 16px;
        display: grid;
        place-items: center;
        color: var(--brass-500);
        font-weight: 900;
        font-size: 32px;
}

.arwa-login-title {
        text-align: center;
        font-size: 20px;
        font-weight: 800;
        color: var(--petrol-900);
        margin: 0 0 4px;
}

.arwa-login-sub {
        text-align: center;
        font-size: 13px;
        color: var(--muted-foreground);
        margin: 0 0 24px;
}

.arwa-pin-input {
        text-align: center;
        font-size: 24px;
        letter-spacing: 8px;
        font-variant-numeric: tabular-nums;
}

.arwa-login-error {
        background: #fee2e2;
        color: #991b1b;
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 13px;
        text-align: center;
        margin-bottom: 12px;
}

.arwa-login-hint {
        text-align: center;
        font-size: 11px;
        color: var(--muted-foreground);
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--border);
}

/* ──────────────────────────────────────────────
   التذييل (Sticky Footer)
   ────────────────────────────────────────────── */
.arwa-footer {
        background: var(--petrol-950);
        color: var(--petrol-200);
        padding: 16px 24px;
        text-align: center;
        font-size: 12px;
        margin-top: auto;
}

.arwa-footer a { color: var(--brass-300); text-decoration: none; }

/* ──────────────────────────────────────────────
   الإشعارات (Toast)
   ────────────────────────────────────────────── */
.arwa-toast-container {
        position: fixed;
        top: 80px;
        left: 16px;
        z-index: 100;
        display: flex;
        flex-direction: column;
        gap: 8px;
        pointer-events: none;
}

.arwa-toast {
        background: #fff;
        border: 1px solid var(--border);
        border-inline-start: 4px solid var(--petrol-500);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: var(--shadow-lg);
        font-size: 13px;
        font-weight: 600;
        color: var(--petrol-900);
        pointer-events: auto;
        min-width: 280px;
        max-width: 360px;
        animation: arwa-slide-in 0.2s ease-out;
}

.arwa-toast-success { border-inline-start-color: #16a34a; }
.arwa-toast-error { border-inline-start-color: var(--destructive); }
.arwa-toast-info { border-inline-start-color: var(--petrol-500); }

@keyframes arwa-slide-in {
        from { opacity: 0; transform: translateX(-20px); }
        to { opacity: 1; transform: translateX(0); }
}

/* ──────────────────────────────────────────────
   حالات مساعدة
   ────────────────────────────────────────────── */
.arwa-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 24px;
        color: var(--muted-foreground);
        font-size: 13px;
}

.arwa-spinner {
        width: 18px;
        height: 18px;
        border: 2px solid var(--petrol-200);
        border-top-color: var(--petrol-500);
        border-radius: 50%;
        animation: arwa-spin 0.8s linear infinite;
}

@keyframes arwa-spin {
        to { transform: rotate(360deg); }
}

.arwa-empty {
        text-align: center;
        padding: 32px 16px;
        color: var(--muted-foreground);
        font-size: 13px;
}

.arwa-flex { display: flex; }
.arwa-flex-between { display: flex; align-items: center; justify-content: space-between; }
.arwa-gap-2 { gap: 8px; }
.arwa-gap-3 { gap: 12px; }
.arwa-gap-4 { gap: 16px; }
.arwa-items-center { align-items: center; }
.arwa-flex-wrap { flex-wrap: wrap; }
.arwa-mt-2 { margin-top: 8px; }
.arwa-mt-4 { margin-top: 16px; }
.arwa-mb-2 { margin-bottom: 8px; }
.arwa-mb-4 { margin-bottom: 16px; }
.arwa-text-sm { font-size: 13px; }
.arwa-text-xs { font-size: 11px; }
.arwa-text-muted { color: var(--muted-foreground); }
.arwa-text-petrol { color: var(--petrol-800); }
.arwa-text-danger { color: var(--destructive); }
.arwa-font-bold { font-weight: 700; }
.arwa-font-extrabold { font-weight: 800; }
.arwa-w-full { width: 100%; }

/* ──────────────────────────────────────────────
   شريط التمرير الرفيع
   ────────────────────────────────────────────── */
.arwa-thin-scroll {
        scrollbar-width: thin;
        scrollbar-color: var(--petrol-200) transparent;
}
.arwa-thin-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.arwa-thin-scroll::-webkit-scrollbar-track { background: transparent; }
.arwa-thin-scroll::-webkit-scrollbar-thumb { background: var(--petrol-200); border-radius: 999px; }
.arwa-thin-scroll::-webkit-scrollbar-thumb:hover { background: var(--petrol-300); }

/* ──────────────────────────────────────────────
   الطباعة — نسخة ورقية نظيفة
   ────────────────────────────────────────────── */
@media print {
        .arwa-header, .arwa-sidebar, .arwa-footer, .arwa-tabs-list,
        .arwa-no-print { display: none !important; }
        /* المودالات والنوافذ المنبثقة لا تُطبع فوق المحتوى */
        .arwa-toast-container,
        [id$="-modal"] { display: none !important; }
        .arwa-app { background: #fff !important; }
        .arwa-card { box-shadow: none !important; border: 1px solid #999 !important; }
        @page { size: A4 landscape; margin: 12mm; }
}

/* ──────────────────────────────────────────────
   شعار أروى الفعلي (arwa-logo.jpg)
   ────────────────────────────────────────────── */
.arwa-login-logo-img {
        width: 120px;
        height: 120px;
        margin: 0 auto 16px;
        display: block;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
        object-fit: cover;
        background: #fff;
}

.arwa-brand-logo-img {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        flex-shrink: 0;
}

@media (max-width: 480px) {
        .arwa-login-logo-img { width: 100px; height: 100px; }
        .arwa-brand-logo-img { width: 40px; height: 40px; }
}

/* ════════════════════════════════════════════════════════════════
   v1.2.4 — تقرير الإنتاج اليومي (نموذج الورديات المطابق للنموذج الورقي)
   ════════════════════════════════════════════════════════════════ */
.arwa-dr-block { margin: 0 0 28px; }
.arwa-dr-titlebar { margin-bottom: 8px; }
.arwa-dr-company { text-align: center; font-weight: 800; font-size: 16px; color: #111; }
.arwa-dr-dept { text-align: center; font-weight: 700; font-size: 14px; color: #222; margin-top: 2px; }
.arwa-dr-bar {
        display: flex; flex-wrap: wrap; gap: 6px 28px;
        justify-content: space-between; align-items: center;
        background: #E2EFDA; border: 1.5px solid #000; border-bottom: 0;
        padding: 8px 16px; font-weight: 700; font-size: 13px; color: #111;
}
.arwa-dr-table {
        width: 100%; border-collapse: collapse; table-layout: fixed;
        background: #fff; border: 2px solid #000;
}
.arwa-dr-table th, .arwa-dr-table td {
        border: 1px solid #000; text-align: center;
        padding: 8px 4px; font-size: 12.5px; vertical-align: middle; color: #111;
}
.arwa-dr-head th { background: #2E74B5; color: #fff; font-weight: 800; font-size: 12px; line-height: 1.6; padding: 8px 3px; }
.arwa-dr-peach { background: #F8CBAD; padding: 0 !important; width: 30px; border: 1px solid #000; }
.arwa-dr-vertical {
        writing-mode: vertical-rl; text-orientation: mixed;
        display: inline-block; font-weight: 800; font-size: 12.5px;
        letter-spacing: 1px; padding: 10px 0; color: #111;
}
.arwa-dr-mcode { background: #DDEBF7; font-weight: 700; }
.arwa-dr-totals-label { background: #F8CBAD; font-weight: 800; }
.arwa-dr-totals td { background: #FDF6EC; }
.arwa-dr-note-label { background: #F8CBAD; font-weight: 800; font-size: 11.5px; line-height: 1.7; }
.arwa-dr-note-cell { height: 80px; text-align: right !important; vertical-align: top !important; padding: 6px 10px !important; }
.arwa-dr-note-text { font-size: 12px; line-height: 1.8; white-space: pre-wrap; word-wrap: break-word; color: #111; }
.arwa-dr-signs {
        display: flex; justify-content: space-between; align-items: center;
        padding: 16px 34px 2px; font-weight: 700; font-size: 13px; color: #111;
}
.arwa-dr-signs span { position: relative; padding-top: 30px; }
.arwa-dr-signs span::before {
        content: ''; position: absolute; top: 0; inset-inline: 0;
        border-bottom: 1.5px dotted #444;
}

/* ── قواعد الطباعة: كل وردية في صفحة A4 مستقلة ── */
@media print {
        @page { size: A4 portrait; margin: 8mm; }
        body.arwa-print-daily * { visibility: hidden !important; }
        body.arwa-print-daily #arwa-daily-print,
        body.arwa-print-daily #arwa-daily-print * { visibility: visible !important; }
        body.arwa-print-daily #arwa-daily-print {
                position: absolute; top: 0; right: 0; left: 0;
                width: 100%; margin: 0; padding: 0;
        }
        body.arwa-print-daily .arwa-dr-noprint { display: none !important; }
        /* v1.2.8: تكييف الجدول (9 أعمدة) مع عرض A4 — إلغاء min-width الخاص بالشاشة */
        body.arwa-print-daily .arwa-dr-twrap { overflow: visible !important; }
        body.arwa-print-daily .arwa-dr-table { min-width: 0 !important; width: 100% !important; }
        body.arwa-print-daily .arwa-dr-block {
                page-break-after: always; break-after: page;
                page-break-inside: avoid; break-inside: avoid;
        }
        body.arwa-print-daily .arwa-dr-block:last-child { page-break-after: auto; break-after: auto; }
        body.arwa-print-daily .arwa-dr-block:first-child { margin-top: 0; }
        body.arwa-print-daily *,
        body.arwa-print-daily *::before,
        body.arwa-print-daily *::after {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
        }
        /* تكبير الخط قليلاً على الورق لقراءة أفضل */
        body.arwa-print-daily .arwa-dr-table th,
        body.arwa-print-daily .arwa-dr-table td { font-size: 11.5px; padding: 7px 3px; }
        body.arwa-print-daily .arwa-dr-note-cell { height: 60px; }
}

/* تمرير أفقي للجدول العريض على شاشات الجوال (v1.2.4) */
.arwa-dr-twrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.arwa-dr-table { min-width: 680px; }

/* ════════════════════════════════════════════════════════════════
   v1.2.5 — تقرير الجودة (النموذج الورقي: خطوط الإنتاج M1-M5)
   ════════════════════════════════════════════════════════════════ */
.arwa-qr-block { margin: 0 0 28px; }
.arwa-qr-titlebar { margin-bottom: 8px; }
.arwa-qr-company { text-align: center; font-weight: 800; font-size: 16px; color: #111; }
.arwa-qr-dept { text-align: center; font-weight: 700; font-size: 14px; color: #222; margin-top: 2px; }

/* شريط اليوم / التقرير / الوردية — ثلاث خانات بإطار أسود كالنموذج */
.arwa-qr-bar {
        display: grid; grid-template-columns: 24% 1fr 26%;
        border: 1.5px solid #000; border-bottom: 0;
        background: #fff; font-weight: 700; font-size: 13px; color: #111;
}
.arwa-qr-bar > div {
        padding: 8px 10px; text-align: center;
        border-inline-start: 1.5px solid #000; min-height: 40px;
        display: flex; align-items: center; justify-content: center; line-height: 1.5;
}
.arwa-qr-bar > div:last-child { border-inline-start: 0; }
.arwa-qr-bar-date { font-size: 12.5px; }
.arwa-qr-bar-title { font-weight: 800; font-size: 14px; }

.arwa-qr-table {
        width: 100%; border-collapse: collapse; table-layout: fixed;
        background: #fff; border: 2px solid #000;
}
.arwa-qr-table th, .arwa-qr-table td {
        border: 1px solid #000; text-align: center;
        padding: 6px 3px; font-size: 12px; vertical-align: middle; color: #111;
        word-wrap: break-word; overflow-wrap: break-word;
}
.arwa-qr-head th {
        background: #2E74B5; color: #fff; font-weight: 800;
        font-size: 13px; padding: 8px 3px; letter-spacing: 0.3px;
}
.arwa-qr-subhead th { padding: 6px 2px; line-height: 1.45; }
.arwa-qr-green { background: #C6E0B4; font-weight: 800; }
.arwa-qr-peach { background: #F8CBAD; font-weight: 800; }

/* صفوف السجلات — ارتفاع ثابت كالنموذج الورقي حتى الفارغة منها */
.arwa-qr-pref, .arwa-qr-defect { height: 30px; font-size: 12px; }
.arwa-qr-pref { font-weight: 700; }

/* خانة تقرير فني الجودة (زرقاء) + مساحة التقرير */
.arwa-qr-tech-label {
        background: #5B9BD5; color: #111; font-weight: 800;
        font-size: 13px; line-height: 1.7; padding: 10px 6px !important;
}
.arwa-qr-report-cell {
        text-align: right !important; padding: 8px 12px !important;
        font-size: 12px; line-height: 1.8; height: 74px; vertical-align: top !important;
}

/* التواقيع الأربعة أسفل الجدول */
.arwa-qr-signs {
        display: flex; justify-content: space-between; align-items: flex-start;
        padding: 18px 22px 2px; font-weight: 700; font-size: 12.5px; color: #111;
        gap: 8px; flex-wrap: wrap;
}
.arwa-qr-signs span { position: relative; padding-top: 30px; text-align: center; }
.arwa-qr-signs span::before {
        content: ''; position: absolute; top: 0; inset-inline: 6px;
        border-bottom: 1.5px dotted #444;
}
.arwa-qr-sign-name {
        display: block; margin-top: 4px; font-size: 11px; font-weight: 700; color: #333;
}

/* ── قواعد الطباعة: كل وردية في صفحة A4 مستقلة ── */
@media print {
        body.arwa-print-quality * { visibility: hidden !important; }
        body.arwa-print-quality #arwa-quality-print,
        body.arwa-print-quality #arwa-quality-print * { visibility: visible !important; }
        body.arwa-print-quality #arwa-quality-print {
                position: absolute; top: 0; right: 0; left: 0;
                width: 100%; margin: 0; padding: 0;
        }
        body.arwa-print-quality .arwa-qr-noprint { display: none !important; }
        body.arwa-print-quality .arwa-qr-block {
                page-break-after: always; break-after: page;
                page-break-inside: avoid; break-inside: avoid;
        }
        body.arwa-print-quality .arwa-qr-block:last-child { page-break-after: auto; break-after: auto; }
        body.arwa-print-quality .arwa-qr-block:first-child { margin-top: 0; }
        body.arwa-print-quality *,
        body.arwa-print-quality *::before,
        body.arwa-print-quality *::after {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
        }
        body.arwa-print-quality .arwa-qr-table th,
        body.arwa-print-quality .arwa-qr-table td { font-size: 11px; padding: 6px 2px; }
        body.arwa-print-quality .arwa-qr-pref,
        body.arwa-print-quality .arwa-qr-defect { height: 26px; }
        body.arwa-print-quality .arwa-qr-report-cell { height: 64px; }
}

/* تمرير أفقي للجدول على شاشات الجوال (v1.2.5) */
.arwa-qr-twrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.arwa-qr-table { min-width: 660px; }

/* الشريط العلوي يتكدس عمودياً على الجوال (v1.2.5) */
@media (max-width: 640px) {
        .arwa-qr-bar { grid-template-columns: 1fr; }
        .arwa-qr-bar > div {
                border-inline-start: 0; min-height: 0;
                border-top: 1px solid #000; padding: 7px 8px;
        }
        .arwa-qr-bar > div:first-child { border-top: 0; }
        .arwa-qr-signs { justify-content: center; row-gap: 16px; }
}

/* ════════════════════════════════════════════════════════════════
   v1.2.6 — نموذج إدخال تقرير الإنتاج اليومي (بالشكل الورقي المطابق)
   v1.2.8 — الأعمدة السبعة: رقم الماكينة | الإنتاج بالكرتون | عبوة الكرتون |
   إجمالي عبوة الكراتين (محسوب) | الوزن (البريفورم) | الإنتاج بالكيلوجرام (محسوب) |
   الإنتاج بالطن (محسوب) | السكراب — مع صف الاجماليات الفوري
   ════════════════════════════════════════════════════════════════ */
.arwa-dpf { background: #fff; }
.arwa-dpf-titlebar { margin-bottom: 8px; }
.arwa-dpf-company { text-align: center; font-weight: 800; font-size: 16px; color: #111; }
.arwa-dpf-dept { text-align: center; font-weight: 700; font-size: 14px; color: #222; margin-top: 2px; }

/* شريط اليوم / التاريخ / الوردية — أخضر فاتح كالنموذج الورقي */
.arwa-dpf-bar {
        display: flex; flex-wrap: wrap; gap: 6px 28px;
        justify-content: space-between; align-items: center;
        background: #C6E0B4; border: 1.5px solid #000; border-bottom: 0;
        padding: 8px 16px; font-weight: 700; font-size: 13px; color: #111;
}

.arwa-dpf-table {
        width: 100%; border-collapse: collapse; table-layout: fixed;
        background: #fff; border: 2px solid #000;
}
.arwa-dpf-table th, .arwa-dpf-table td {
        border: 1px solid #000; text-align: center;
        padding: 6px 3px; font-size: 12.5px; vertical-align: middle; color: #111;
}
.arwa-dpf-head th {
        background: #5B9BD5; color: #111; font-weight: 800;
        font-size: 12px; line-height: 1.6; padding: 8px 3px;
}
.arwa-dpf-peach { background: #F8CBAD; padding: 0 !important; width: 30px; border: 1px solid #000; }
.arwa-dpf-vertical {
        writing-mode: vertical-rl; text-orientation: mixed;
        display: inline-block; font-weight: 800; font-size: 12.5px;
        letter-spacing: 1px; padding: 10px 0; color: #111;
}
.arwa-dpf-mcode { background: #BDD7EE; font-weight: 800; font-size: 13px; }

/* حقول الإدخال داخل خلايا النموذج — بلا حدود كأنها مكتوبة على الورق */
.arwa-dpf-input {
        width: 100%; min-width: 58px; box-sizing: border-box;
        border: 0; background: transparent; text-align: center;
        font: inherit; font-weight: 700; color: #111;
        padding: 5px 2px; outline-offset: -2px;
}
.arwa-dpf-input:focus { outline: 2px solid #2E74B5; background: #FFF7E6; }
.arwa-dpf-input[readonly] { color: #333; background: transparent; }
.arwa-dpf-input::-webkit-outer-spin-button,
.arwa-dpf-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.arwa-dpf-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* v1.2.8: الخلايا المحسوبة تلقائياً (إجمالي العبوة / كجم / طن) — ظل خفيف يدل على الحساب الآلي */
.arwa-dpf-calc { background: #FFF9EF !important; color: #1F4E79 !important; cursor: default; }

/* v1.2.8: تلميح الحساب الفوري فوق الجدول (لا يُطبع) */
.arwa-dpf-hint {
        font-size: 11px; color: #5a6b7c; background: #F2F7FB;
        border: 1px dashed #B9CFE3; border-bottom: 0;
        padding: 5px 12px; line-height: 1.8;
}

/* صف الاجماليات */
.arwa-dpf-totals td { background: #FDF6EC; font-weight: 800; font-size: 13px; }
.arwa-dpf-totals-label { background: #F8CBAD; font-weight: 800; }

/* خانة تقرير مشرف الإنتاج */
.arwa-dpf-note-label { background: #F8CBAD; font-weight: 800; font-size: 11.5px; line-height: 1.7; }
.arwa-dpf-note-cell { height: 96px; text-align: right !important; vertical-align: top !important; padding: 4px !important; }
.arwa-dpf-note {
        width: 100%; height: 100%; min-height: 86px; box-sizing: border-box;
        border: 0; background: transparent; resize: vertical;
        font: inherit; font-size: 12.5px; line-height: 1.8;
        text-align: right; color: #111; padding: 4px 6px;
}
.arwa-dpf-note:focus { outline: 2px solid #2E74B5; background: #FFF7E6; }
.arwa-dpf-note[readonly] { color: #333; }

/* شريط الأزرار فوق النموذج */
.arwa-dpf-actions {
        display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
        margin-bottom: 12px;
}

/* التواقيع الثلاثة أسفل الجدول */
.arwa-dpf-signs {
        display: flex; justify-content: space-between; align-items: flex-start;
        padding: 18px 30px 2px; font-weight: 700; font-size: 13px; color: #111;
        gap: 8px; flex-wrap: wrap;
}
.arwa-dpf-signs span { position: relative; padding-top: 30px; text-align: center; }
.arwa-dpf-signs span::before {
        content: ''; position: absolute; top: 0; inset-inline: 8px;
        border-bottom: 1.5px dotted #444;
}
.arwa-dpf-signs em {
        display: block; font-style: normal; font-weight: 700;
        font-size: 11px; color: #333; margin-top: 4px;
}

/* تمرير أفقي للنموذج على الجوال (9 أعمدة — v1.2.8) */
.arwa-dpf-twrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.arwa-dpf-table { min-width: 780px; }

/* ── الطباعة: النموذج الورقي وحده في صفحة A4 ── */
@media print {
        body.arwa-print-entryform * { visibility: hidden !important; }
        body.arwa-print-entryform #arwa-entry-form,
        body.arwa-print-entryform #arwa-entry-form * { visibility: visible !important; }
        body.arwa-print-entryform #arwa-entry-form {
                position: absolute; top: 0; right: 0; left: 0;
                width: 100%; margin: 0; padding: 0;
        }
        body.arwa-print-entryform .arwa-dpf-actions { display: none !important; }
        /* v1.2.8: تكييف الجدول (9 أعمدة) مع عرض A4 — إلغاء min-width الخاص بالشاشة */
        body.arwa-print-entryform .arwa-dpf-twrap { overflow: visible !important; }
        body.arwa-print-entryform .arwa-dpf-table { min-width: 0 !important; width: 100% !important; }
        body.arwa-print-entryform *,
        body.arwa-print-entryform *::before,
        body.arwa-print-entryform *::after {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
        }
        /* قيم الحقول تُطبع كخلايا النموذج */
        body.arwa-print-entryform .arwa-dpf-input {
                border: 0 !important; background: transparent !important;
                font-size: 12px; padding: 6px 2px;
        }
        body.arwa-print-entryform .arwa-dpf-hint { display: none !important; }
        body.arwa-print-entryform .arwa-dpf-note {
                border: 0 !important; background: transparent !important;
                resize: none; overflow: hidden;
        }
        body.arwa-print-entryform .arwa-dpf-table th,
        body.arwa-print-entryform .arwa-dpf-table td { font-size: 11.5px; padding: 7px 3px; }
        body.arwa-print-entryform .arwa-dpf-note-cell { height: 70px; }
}

/* ════════════════════════════════════════════════════════════════
   v1.2.7 — نموذج إدخال تقرير الجودة (بالشكل الورقي المطابق)
   شبكة صفوف × خطوط إنتاج: رقم البيفورم (أخضر) / نوع العيب (خوخي)
   + خانة «تقرير فني الجودة» الزرقاء + التواقيع الأربعة
   + أشرطة حالة الاعتماد (تقرير الإنتاج اليومي وتقرير الجودة)
   ════════════════════════════════════════════════════════════════ */
.arwa-qef { background: #fff; }
.arwa-qef-titlebar { margin-bottom: 8px; }
.arwa-qef-company { text-align: center; font-weight: 800; font-size: 16px; color: #111; }
.arwa-qef-dept { text-align: center; font-weight: 700; font-size: 14px; color: #222; margin-top: 2px; }

/* شريط اليوم / التقرير / الوردية الثلاثي — كالنموذج الورقي */
.arwa-qef-bar {
        display: grid; grid-template-columns: 1.2fr 1fr 1.2fr;
        border: 1.5px solid #000; border-bottom: 0;
        background: #fff;
}
.arwa-qef-bar > div {
        padding: 8px 10px; text-align: center; font-size: 13px;
        color: #111; border-inline-start: 1.5px solid #000;
        display: flex; align-items: center; justify-content: center; gap: 6px;
}
.arwa-qef-bar > div:first-child { border-inline-start: 0; }
.arwa-qef-bar-date { font-size: 12.5px; }
.arwa-qef-bar-title { font-weight: 800; font-size: 14.5px; letter-spacing: .3px; }

.arwa-qef-table {
        width: 100%; border-collapse: collapse; table-layout: fixed;
        background: #fff; border: 2px solid #000;
}
.arwa-qef-table th, .arwa-qef-table td {
        border: 1px solid #000; text-align: center;
        padding: 6px 2px; font-size: 12px; vertical-align: middle; color: #111;
}
.arwa-qef-head th {
        background: #2E74B5; color: #fff; font-weight: 800;
        font-size: 12px; line-height: 1.6; padding: 8px 3px;
}
.arwa-qef-subhead th { padding: 6px 2px; line-height: 1.45; }
.arwa-qef-green { background: #C6E0B4; font-weight: 800; }
.arwa-qef-peach { background: #F8CBAD; font-weight: 800; }

/* خلايا الشبكة وحقول الإدخال — بلا حدود كأنها مكتوبة على الورق */
.arwa-qef-prefcell, .arwa-qef-defectcell { height: 34px; padding: 0 !important; }
.arwa-qef-input {
        width: 100%; box-sizing: border-box;
        border: 0; background: transparent; text-align: center;
        font: inherit; font-size: 12px; font-weight: 700; color: #111;
        padding: 6px 2px; outline-offset: -2px;
}
.arwa-qef-input:focus { outline: 2px solid #2E74B5; background: #FFF7E6; }
.arwa-qef-input[readonly] { color: #333; background: transparent; }
.arwa-qef-input::-webkit-outer-spin-button,
.arwa-qef-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.arwa-qef-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.arwa-qef-prefcell .arwa-qef-input { font-weight: 800; }

/* أزرار إضافة/حذف الصفوف */
.arwa-qef-grid-actions {
        display: flex; align-items: center; flex-wrap: wrap;
        padding: 8px 2px; gap: 6px;
}

/* خانة تقرير فني الجودة */
.arwa-qef-tech-label {
        background: #5B9BD5; font-weight: 800; font-size: 11.5px;
        line-height: 1.7; color: #111;
}
.arwa-qef-report-cell {
        height: 96px; text-align: right !important;
        vertical-align: top !important; padding: 4px !important;
}
.arwa-qef-note {
        width: 100%; height: 100%; min-height: 86px; box-sizing: border-box;
        border: 0; background: transparent; resize: vertical;
        font: inherit; font-size: 12.5px; line-height: 1.8;
        text-align: right; color: #111; padding: 4px 6px;
}
.arwa-qef-note:focus { outline: 2px solid #2E74B5; background: #FFF7E6; }
.arwa-qef-note[readonly] { color: #333; }

/* شريط أزرار النموذج */
.arwa-qef-actions {
        display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
        margin-bottom: 12px;
}

/* التواقيع الأربعة */
.arwa-qef-signs {
        display: flex; justify-content: space-between; align-items: flex-start;
        padding: 18px 20px 2px; font-weight: 700; font-size: 12.5px; color: #111;
        gap: 8px; flex-wrap: wrap;
}
.arwa-qef-signs span { position: relative; padding-top: 30px; text-align: center; }
.arwa-qef-signs span::before {
        content: ''; position: absolute; top: 0; inset-inline: 6px;
        border-bottom: 1.5px dotted #444;
}
.arwa-qef-signs em {
        display: block; font-style: normal; font-weight: 700;
        font-size: 11px; color: #333; margin-top: 4px;
}

/* تمرير أفقي للنموذج على الجوال */
.arwa-qef-twrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.arwa-qef-table { min-width: 660px; }

/* شريط حالة الاعتماد فوق بلوكات التقارير (لوحة التقارير + تقارير الجودة) */
.arwa-dr-approval, .arwa-qr-approval {
        display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
        background: #FDF6EC; border: 1px solid #E7D8BE; border-radius: 8px;
        padding: 8px 12px; margin-bottom: 10px;
}

/* الشريط الثلاثي يتكدس عمودياً على الجوال */
@media (max-width: 640px) {
        .arwa-qef-bar { grid-template-columns: 1fr; }
        .arwa-qef-bar > div {
                border-inline-start: 0; border-top: 1.5px solid #000;
        }
        .arwa-qef-bar > div:first-child { border-top: 0; }
        .arwa-qef-signs { justify-content: center; row-gap: 16px; }
}

/* ── الطباعة: نموذج إدخال الجودة وحده في صفحة A4 ── */
@media print {
        body.arwa-print-qualityform * { visibility: hidden !important; }
        body.arwa-print-qualityform #arwa-quality-entry-form,
        body.arwa-print-qualityform #arwa-quality-entry-form * { visibility: visible !important; }
        body.arwa-print-qualityform #arwa-quality-entry-form {
                position: absolute; top: 0; right: 0; left: 0;
                width: 100%; margin: 0; padding: 0;
        }
        body.arwa-print-qualityform .arwa-qef-actions,
        body.arwa-print-qualityform .arwa-qef-grid-actions { display: none !important; }
        body.arwa-print-qualityform *,
        body.arwa-print-qualityform *::before,
        body.arwa-print-qualityform *::after {
                -webkit-print-color-adjust: exact !important;
                print-color-adjust: exact !important;
        }
        /* قيم الحقول تُطبع كخلايا النموذج */
        body.arwa-print-qualityform .arwa-qef-input {
                border: 0 !important; background: transparent !important;
                font-size: 11.5px; padding: 6px 2px;
        }
        body.arwa-print-qualityform .arwa-qef-note {
                border: 0 !important; background: transparent !important;
                resize: none; overflow: hidden;
        }
        body.arwa-print-qualityform .arwa-qef-table th,
        body.arwa-print-qualityform .arwa-qef-table td { font-size: 11px; padding: 6px 2px; }
        body.arwa-print-qualityform .arwa-qef-prefcell,
        body.arwa-print-qualityform .arwa-qef-defectcell { height: 27px; }
        body.arwa-print-qualityform .arwa-qef-report-cell { height: 64px; }
}

/* ═══════════════════════════════════════════════════════════════
   v1.2.9 — النماذج المعتمدة المحفوظة في النظام
   شارة الاعتماد على نماذج الإدخال + بطاقة النماذج المعتمدة بالإعدادات
   ═══════════════════════════════════════════════════════════════ */
.arwa-adopted-badge {
        display: inline-flex; align-items: center; gap: 6px;
        background: #E7F4EA; color: #1E7145;
        border: 1px solid #BFE3C9; border-radius: 999px;
        padding: 4px 12px; font-size: 12px; font-weight: 600;
        white-space: nowrap; line-height: 1.4;
}
.arwa-adopted-grid {
        display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 12px;
}
.arwa-adopted-form {
        border: 1px solid var(--border); border-radius: 10px;
        padding: 14px 16px; background: #FBFBF8;
}
.arwa-adopted-form-title {
        font-weight: 700; font-size: 14px; color: var(--ink-800, #1F2937);
        margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.arwa-adopted-form-title::before { content: '✓'; color: #1E7145; font-weight: 700; }
.arwa-adopted-cols {
        margin: 0 0 8px; padding-inline-start: 18px;
        font-size: 12.5px; color: #374151;
        display: grid; grid-template-columns: 1fr; gap: 2px;
}
.arwa-adopted-cols li { line-height: 1.6; }
.arwa-adopted-lines { font-size: 12.5px; color: #4B5563; display: grid; gap: 3px; }
.arwa-adopted-lines div { line-height: 1.6; }

/* الشارة لا تُطبع — النموذج المطبوع مطابق للورقي حصراً */
@media print {
        .arwa-adopted-badge { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   v1.3.0 — التبويب الموحّد «الإنتاج والوردية»
   مبدّل داخلي بخطوتين (① تقرير الإنتاج اليومي / ② نهاية الوردية)
   + أزرار الاعتماد وإعادة الفتح
   ════════════════════════════════════════════════════════════════ */
.arwa-hub-switcher {
        display: grid; grid-template-columns: 1fr 1fr; gap: 0;
        background: #fff; border: 1.5px solid #d4d4d8; border-radius: 12px;
        overflow: hidden; margin-bottom: 14px;
        box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.arwa-hub-tab {
        display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
        gap: 8px; padding: 13px 12px; border: 0; cursor: pointer;
        background: transparent; font-family: inherit; font-size: 14px; font-weight: 700;
        color: #52525b; transition: background .15s ease, color .15s ease;
        min-height: 48px;
}
.arwa-hub-tab + .arwa-hub-tab { border-inline-start: 1.5px solid #d4d4d8; }
.arwa-hub-tab:hover { background: #fafaf9; color: #18181b; }
.arwa-hub-tab.is-active { background: var(--brass-500); color: #1c1917; }
.arwa-hub-tab-num { font-weight: 800; font-size: 15px; }
.arwa-hub-tab-chip {
        font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
        background: #f4f4f5; color: #52525b; display: inline-flex; align-items: center; gap: 4px;
}
.arwa-hub-tab.is-active .arwa-hub-tab-chip { background: rgba(255,255,255,.75); color: #1c1917; }

/* أزرار الاعتماد وإعادة الفتح */
.arwa-btn-approved {
        background: #15803d !important; color: #fff !important;
        border-color: #15803d !important;
}
.arwa-btn-approved:hover { background: #166534 !important; }
.arwa-btn-approved svg { vertical-align: middle; }

@media (max-width: 640px) {
        .arwa-hub-switcher { grid-template-columns: 1fr; }
        .arwa-hub-tab + .arwa-hub-tab { border-inline-start: 0; border-top: 1.5px solid #d4d4d8; }
        .arwa-hub-tab { justify-content: flex-start; }
}

/* الشريط لا يُطبع */
@media print {
        .arwa-hub-switcher { display: none !important; }
}

/* ══════════════════════════════════════════════
   v1.4.0 — تقرير التوقفات والأعطال
   تبويب «التوقفات والأعطال» + قسم التوقفات في نماذج الإدخال
   ══════════════════════════════════════════════ */

/* فلاتر التقرير — شبكة مضغوطة */
.arwa-dt-filters {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 14px;
}
@media (max-width: 780px) {
        .arwa-dt-filters { grid-template-columns: 1fr; }
}

/* جدول التقرير */
.arwa-dt-table th {
        background: #2E74B5;
        color: #fff;
        font-weight: 800;
        white-space: nowrap;
        padding: 8px 10px;
}
.arwa-dt-table td {
        padding: 8px 10px;
        vertical-align: top;
}
.arwa-dt-table tbody tr:nth-child(even) { background: #F4F8FC; }
.arwa-dt-table tbody tr:hover { background: #EAF2FA; }
.arwa-dt-row-new { box-shadow: inset 3px 0 0 #B45309; }

/* لوحة تحديث المعالجة */
.arwa-dt-handle-panel {
        background: #FFF8EC;
        border: 1px solid #E4C98A;
        border-radius: 12px;
        padding: 14px 16px;
        margin-bottom: 14px;
}

/* قسم التوقفات داخل نماذج الإدخال (الإنتاج اليومي / الجودة) */
.arwa-dtf-section {
        border: 1px solid #CBD5E1;
        border-radius: 12px;
        padding: 14px 16px;
        margin-top: 16px;
        background: #FBFDFF;
}
.arwa-dtf-section h3 {
        margin: 0 0 4px;
        font-size: 14px;
        font-weight: 800;
        color: #1F4E79;
        display: flex;
        align-items: center;
        gap: 6px;
}
.arwa-dtf-section .arwa-dtf-sub {
        font-size: 12px;
        color: #64748B;
        margin-bottom: 10px;
}
.arwa-dtf-table {
        width: 100%;
        border-collapse: collapse;
        min-width: 860px;
}
.arwa-dtf-table th {
        background: #2E74B5;
        color: #fff;
        font-weight: 800;
        font-size: 12px;
        padding: 7px 8px;
        white-space: nowrap;
}
.arwa-dtf-table td {
        border: 1px solid #D7E3EF;
        padding: 4px 6px;
        background: #fff;
}
.arwa-dtf-table .arwa-dtf-duration {
        font-weight: 700;
        white-space: nowrap;
        text-align: center;
        font-size: 13px;
}
.arwa-dtf-table .arwa-dtf-remove {
        background: none;
        border: none;
        color: #B91C1C;
        font-size: 15px;
        cursor: pointer;
        padding: 2px 8px;
}
.arwa-dtf-table .arwa-dtf-remove:disabled { opacity: 0.35; cursor: not-allowed; }
.arwa-dtf-add {
        margin-top: 10px;
}
/* شارة حالة المعالجة داخل قسم النموذج */
.arwa-dtf-status {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 700;
}
.arwa-dtf-status.NEW { background: #FEF3C7; color: #92400E; }
.arwa-dtf-status.IN_PROGRESS { background: #E0E7FF; color: #3730A3; }
.arwa-dtf-status.RESOLVED { background: #D1FAE5; color: #065F46; }

/* ═══ طباعة تقرير التوقفات والأعطال — A4 ═══ */
@media print {
        body.arwa-print-downtimes * { visibility: hidden !important; }
        body.arwa-print-downtimes #arwa-downtimes-report,
        body.arwa-print-downtimes #arwa-downtimes-report * { visibility: visible !important; }
        body.arwa-print-downtimes #arwa-downtimes-report {
                position: absolute !important;
                inset: 0 auto auto 0 !important;
                width: 100% !important;
                margin: 0 !important;
                box-shadow: none !important;
        }
        body.arwa-print-downtimes .arwa-dt-actions,
        body.arwa-print-downtimes .arwa-dt-filters { display: none !important; }
        body.arwa-print-downtimes .arwa-dt-table { min-width: 0 !important; width: 100% !important; font-size: 11px; }
        body.arwa-print-downtimes .arwa-dt-table th { padding: 4px 6px; }
        body.arwa-print-downtimes .arwa-dt-table td { padding: 4px 6px; }
        body.arwa-print-downtimes .arwa-dt-handle-panel { display: none !important; }
        body.arwa-print-downtimes .arwa-dt-table .arwa-dt-actions-col { display: none !important; }
}

/* v1.4.0: قسم التوقفات لا يُطبع مع النموذج الورقي (يبقى مطابقاً للنموذج المعتمد) */
@media print {
        body.arwa-print-qualityform .arwa-dtf-section,
        body.arwa-print-entryform .arwa-dtf-section { display: none !important; }
}

/* ══════════════════════════════════════════════
   v1.4.1 — تقرير سير العمل والتوقفات في نفس شاشة الإنتاج
   + إعلان «لا يوجد توقفات» + ساعات الوردية
   + تقرير المعالجة المفصل (خطوات + صور)
   ══════════════════════════════════════════════ */

/* ترويسة تقرير سير العمل والتوقفات (نهاية الوردية) — نفس شاشة الإنتاج */
.arwa-sr-header {
        background: linear-gradient(180deg, #F8FAFC 0%, #EFF6F9 100%);
        border-right: 4px solid #1F4E79;
}
.arwa-sr-header-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
}
.arwa-sr-header-meta {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 6px;
}

/* شريحة ساعات الوردية */
.arwa-shift-hours {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #ECFDF5;
        border: 1px solid #A7F3D0;
        color: #065F46;
        font-size: 12px;
        font-weight: 700;
        padding: 3px 10px;
        border-radius: 999px;
        white-space: nowrap;
}

/* رأس قسم التوقفات داخل النماذج */
.arwa-dtf-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
        margin-bottom: 4px;
}
.arwa-dtf-head h3 { margin: 0; }

/* خيار إعلان «لا توجد توقفات» */
.arwa-no-dt-check {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: #F8FAFC;
        border: 1px dashed #94A3B8;
        border-radius: 10px;
        padding: 8px 12px;
        margin: 6px 0 8px;
        font-size: 13px;
        font-weight: 700;
        color: #334155;
        cursor: pointer;
        user-select: none;
}
.arwa-no-dt-check input[type="checkbox"] {
        width: 17px;
        height: 17px;
        accent-color: #2E7D32;
        cursor: pointer;
}
.arwa-no-dt-check input:disabled { cursor: not-allowed; }

/* شريط الإعلان الرسمي الأخضر */
.arwa-dt-decl {
        background: #ECFDF5;
        border: 1px solid #6EE7B7;
        border-radius: 10px;
        color: #065F46;
        font-size: 13px;
        padding: 10px 14px;
        margin: 4px 0 10px;
}

/* بطاقة إعلانات «لا توجد توقفات» في التقرير الموحّد */
.arwa-dt-decls {
        background: #F0FDF4;
        border: 1px solid #BBF7D0;
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 14px;
}
.arwa-dt-decls-title {
        font-size: 13px;
        font-weight: 800;
        color: #166534;
        margin-bottom: 8px;
}
.arwa-dt-decls-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
}
.arwa-dt-decl-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #fff;
        border: 1px solid #86EFAC;
        color: #166534;
        border-radius: 999px;
        font-size: 12px;
        padding: 3px 10px;
}
.arwa-dt-decl-chip em {
        font-style: normal;
        color: #64748B;
        font-size: 11px;
}

/* ═══ نافذة تقرير المعالجة المفصل (عرض + تحرير) ═══ */
.arwa-res-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        z-index: 100000;
        overflow-y: auto;
        padding: 24px 12px;
        display: flex;
        justify-content: center;
        align-items: flex-start;
}
.arwa-res-modal {
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
        width: 100%;
        max-width: 860px;
        padding: 18px 20px 22px;
}
.arwa-res-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
        border-bottom: 2px solid #E2E8F0;
        padding-bottom: 10px;
        margin-bottom: 14px;
}
.arwa-res-head h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 800;
        color: #1F4E79;
        display: flex;
        align-items: center;
        gap: 8px;
}
.arwa-res-actions {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        margin-top: 14px;
        flex-wrap: wrap;
}

/* نسخة العرض القابلة للطباعة */
.arwa-res-titlebar {
        border: 1.5px solid #1F4E79;
        border-radius: 8px;
        padding: 8px 12px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        background: #F8FAFC;
}
.arwa-res-company { font-weight: 800; font-size: 14px; color: #1F4E79; }
.arwa-res-dept { font-size: 12px; color: #64748B; }
.arwa-res-title {
        margin: 14px 0 10px;
        font-size: 15px;
        font-weight: 800;
        color: #0F172A;
        display: flex;
        align-items: center;
        gap: 8px;
}
.arwa-res-info {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 12px;
        font-size: 13px;
}
.arwa-res-info th {
        background: #EFF6F9;
        color: #1F4E79;
        font-weight: 700;
        text-align: right;
        padding: 6px 10px;
        border: 1px solid #D7E3EF;
        width: 160px;
        white-space: nowrap;
}
.arwa-res-info td {
        border: 1px solid #D7E3EF;
        padding: 6px 10px;
        color: #0F172A;
}
.arwa-res-block {
        margin-bottom: 12px;
}
.arwa-res-block h3 {
        margin: 0 0 6px;
        font-size: 13px;
        font-weight: 800;
        color: #1F4E79;
        border-right: 3px solid #2E74B5;
        padding-right: 8px;
}
.arwa-res-block p {
        margin: 0;
        font-size: 13px;
        line-height: 1.8;
        color: #0F172A;
        white-space: pre-line;
}
.arwa-res-steps {
        margin: 0;
        padding-right: 20px;
        counter-reset: resstep;
}
.arwa-res-steps li {
        font-size: 13px;
        line-height: 1.9;
        color: #0F172A;
        margin-bottom: 6px;
        padding-right: 4px;
}
.arwa-res-gallery {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
}
.arwa-res-gallery img {
        width: 100%;
        height: 110px;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid #D7E3EF;
        background: #F8FAFC;
        cursor: zoom-in;
}
.arwa-res-signs {
        display: flex;
        gap: 14px;
        flex-wrap: wrap;
        border-top: 1.5px solid #E2E8F0;
        margin-top: 16px;
        padding-top: 12px;
}
.arwa-res-signs span {
        font-size: 12px;
        color: #64748B;
        display: flex;
        flex-direction: column;
        gap: 2px;
}
.arwa-res-signs em {
        font-style: normal;
        font-weight: 800;
        color: #0F172A;
        border-top: 1px dotted #94A3B8;
        padding-top: 4px;
        min-width: 120px;
}
.arwa-res-footnote {
        margin-top: 12px;
        font-size: 11px;
        color: #94A3B8;
}

/* نسخة التحرير */
.arwa-res-editor .arwa-res-editor-meta {
        background: #F8FAFC;
        border: 1px solid #E2E8F0;
        border-radius: 10px;
        padding: 10px 12px;
        margin-bottom: 12px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 13px;
}
.arwa-res-step-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 8px;
}
.arwa-res-step-num {
        flex: 0 0 26px;
        height: 26px;
        border-radius: 50%;
        background: #1F4E79;
        color: #fff;
        font-size: 12px;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-top: 4px;
}
.arwa-res-step-row .arwa-res-step-text { flex: 1; resize: vertical; }
.arwa-res-step-remove {
        background: none;
        border: none;
        color: #B91C1C;
        font-size: 15px;
        cursor: pointer;
        padding: 6px 8px;
}
.arwa-res-files-hint {
        font-size: 12px;
        color: #2E7D32;
        font-weight: 700;
        margin-top: 4px;
}
@media (max-width: 640px) {
        .arwa-res-overlay { padding: 10px 4px; }
        .arwa-res-modal { padding: 14px 12px; }
}

/* ═══ طباعة تقرير المعالجة المفصل — A4 ═══ */
@media print {
        body.arwa-print-dt-resolution * { visibility: hidden !important; }
        body.arwa-print-dt-resolution #arwa-dt-res-overlay,
        body.arwa-print-dt-resolution #arwa-dt-res-overlay * { visibility: visible !important; }
        body.arwa-print-dt-resolution #arwa-dt-res-overlay {
                position: absolute !important;
                inset: 0 auto auto 0 !important;
                background: #fff !important;
                padding: 0 !important;
                overflow: visible !important;
        }
        body.arwa-print-dt-resolution .arwa-res-modal {
                box-shadow: none !important;
                max-width: 100% !important;
                padding: 0 !important;
        }
        body.arwa-print-dt-resolution .arwa-res-noprint,
        body.arwa-print-dt-resolution .arwa-res-actions { display: none !important; }
        body.arwa-print-dt-resolution .arwa-res-gallery img {
                height: 140px;
                page-break-inside: avoid;
        }
}

/* ════════════════════════════════════════════════════════════
   v1.5.0 — إعلان «لا يوجد توقفات» لكل خط إنتاج محدد + حالة الخط
   ════════════════════════════════════════════════════════════ */
.arwa-no-dt-lines {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        background: #F8FAFC;
        border: 1px dashed #94A3B8;
        border-radius: 10px;
        padding: 8px 10px;
        margin: 6px 0 8px;
}
.arwa-no-dt-line {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #fff;
        border: 1px solid #CBD5E1;
        border-radius: 999px;
        padding: 5px 12px;
        font-size: 12.5px;
        color: #334155;
        cursor: pointer;
        user-select: none;
        transition: border-color .15s, background .15s;
}
.arwa-no-dt-line:hover { border-color: #6EE7B7; }
.arwa-no-dt-line input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: #2E7D32;
        cursor: pointer;
        margin: 0;
}
.arwa-no-dt-line input:disabled { cursor: not-allowed; }
.arwa-no-dt-line.is-on {
        background: #ECFDF5;
        border-color: #6EE7B7;
        color: #065F46;
        font-weight: 700;
}
.arwa-no-dt-line b { font-weight: 800; }
.arwa-line-stopped {
        font-style: normal;
        color: #B91C1C;
        font-weight: 700;
        font-size: 11.5px;
}
.arwa-line-badge-stopped {
        display: inline-block;
        background: #FEE2E2;
        color: #991B1B;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 800;
        padding: 1px 6px;
        margin-inline-start: 4px;
        vertical-align: middle;
}
