/* ============================================================================
   🎨 1. نظام الألوان الديناميكي المرتبط بشخصية الروبوت (Dynamic Accent)
   ============================================================================ */

:root,
[data-robot-theme="classic"] {
    --accent-300: #93c5fd;
    --accent-400: #60a5fa;
    --accent-500: #3b82f6;
    --accent-600: #2563eb;
    --accent-800: #1e40af;
    --accent-900-bg: rgba(30, 58, 138, 0.4);
    --accent-glow: rgba(59, 130, 246, 0.28);
}

[data-robot-theme="turbo"] {
    --accent-300: #fcd34d;
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-800: #92400e;
    --accent-900-bg: rgba(120, 53, 15, 0.42);
    --accent-glow: rgba(245, 158, 11, 0.28);
}

[data-robot-theme="chill"] {
    --accent-300: #6ee7b7;
    --accent-400: #34d399;
    --accent-500: #10b981;
    --accent-600: #059669;
    --accent-800: #065f46;
    --accent-900-bg: rgba(6, 78, 59, 0.42);
    --accent-glow: rgba(16, 185, 129, 0.26);
}

[data-robot-theme="kitty"] {
    --accent-300: #f9a8d4;
    --accent-400: #f472b6;
    --accent-500: #ec4899;
    --accent-600: #db2777;
    --accent-800: #9d174d;
    --accent-900-bg: rgba(131, 24, 67, 0.42);
    --accent-glow: rgba(236, 72, 153, 0.28);
}

/* تطبيق اللون تلقائياً على كلاسات brand في Tailwind (الأزرار، النصوص، الحدود، الشارات، والتدرجات) */
.bg-brand-500 { background-color: var(--accent-500) !important; }
.bg-brand-600 { background-color: var(--accent-600) !important; }
.hover\:bg-brand-500:hover { background-color: var(--accent-500) !important; }
.hover\:bg-brand-600:hover { background-color: var(--accent-600) !important; }
.hover\:bg-brand-800:hover { background-color: var(--accent-800) !important; }
[class*="bg-brand-900"] { background-color: var(--accent-900-bg) !important; }

.text-brand-300 { color: var(--accent-300) !important; }
.text-brand-400 { color: var(--accent-400) !important; }
.text-brand-500 { color: var(--accent-500) !important; }

.border-brand-400 { border-color: var(--accent-400) !important; }
.border-brand-500 { border-color: var(--accent-500) !important; }
.border-brand-600 { border-color: var(--accent-600) !important; }
[class*="border-brand-800"],
[class*="border-brand-900"] { border-color: var(--accent-800) !important; }

.from-brand-600 { --tw-gradient-from: var(--accent-600) !important; }
.to-brand-400 { --tw-gradient-to: var(--accent-400) !important; }

/* توهج ناعم لدوائر الميكروفون */
#voice-ripple-1,
#voice-ripple-2 {
    border-color: var(--accent-400) !important;
    box-shadow: 0 0 25px var(--accent-glow) !important;
}

/* توهج الأيقونة النشطة في شريط التنقل السفلي بلون الروبوت */
.nav-active {
    color: var(--accent-400) !important;
}
.nav-active span:first-child {
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ============================================================================
   ☀️ 2. نظام الثيم الفاتح الشامل (Light Mode) وتباين الأنماط الديناميكية
   ============================================================================ */

/* ضبط تباين متغيرات brand وتنعيم التوهج في الوضع الفاتح */
[data-theme="light"],
[data-theme="light"][data-robot-theme="classic"] {
    --accent-300: #2563eb;
    --accent-400: #1d4ed8;
    --accent-800: #93c5fd;
    --accent-900-bg: #eff6ff;
    --accent-glow: rgba(59, 130, 246, 0.16);
}

[data-theme="light"][data-robot-theme="turbo"] {
    --accent-300: #b45309;
    --accent-400: #92400e;
    --accent-800: #fcd34d;
    --accent-900-bg: #fffbeb;
    --accent-glow: rgba(245, 158, 11, 0.16);
}

[data-theme="light"][data-robot-theme="chill"] {
    --accent-300: #047857;
    --accent-400: #065f46;
    --accent-500: #10b981;
    --accent-600: #059669;
    --accent-800: #6ee7b7;
    --accent-900-bg: #ecfdf5;
    --accent-glow: rgba(16, 185, 129, 0.15);
}

[data-theme="light"][data-robot-theme="kitty"] {
    --accent-300: #db2777;
    --accent-400: #be185d;
    --accent-500: #ec4899;
    --accent-600: #db2777;
    --accent-800: #f9a8d4;
    --accent-900-bg: #fdf2f8;
    --accent-glow: rgba(219, 39, 119, 0.16);
}

/* الخلفية العامة للوضع الفاتح */
[data-theme="light"] body,
[data-theme="light"] [class*="bg-slate-950"],
[data-theme="light"] [class*="bg-gray-950"] {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

/* الحاويات الرئيسية */
[data-theme="light"] [class*="bg-slate-900"],
[data-theme="light"] [class*="bg-gray-900"],
[data-theme="light"] [class*="bg-zinc-900"] {
    background-color: #ffffff !important;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

/* بطاقات المهام والعناصر الداخلية */
[data-theme="light"] [class*="bg-slate-800"],
[data-theme="light"] [class*="bg-gray-800"],
[data-theme="light"] [class*="bg-zinc-800"] {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

/* ✅ إصلاح تباين بطاقة المهمة النشطة (قمرة القيادة) وإزالة التدرجات الداكنة في الوضع الفاتح */
[data-theme="light"] #active-task-container,
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-slate-9"],
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-gray-9"],
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-emerald-9"],
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-teal-9"],
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-blue-9"],
[data-theme="light"] [class*="bg-gradient-to-"][class*="from-brand-9"] {
    background-image: none !important;
    background-color: #f8fafc !important;
    border-color: var(--accent-800) !important;
    color: #0f172a !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"][data-robot-theme="chill"] #active-task-container {
    background-color: #f0fdf4 !important;
    border-color: #86efac !important;
}

[data-theme="light"][data-robot-theme="kitty"] #active-task-container {
    background-color: #fff5f9 !important;
    border-color: #fbcfe8 !important;
}

/* توضيح مسار شريط التقدم داخل قمرة القيادة في الوضع الفاتح */
[data-theme="light"] #active-task-container .h-4.rounded-full {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
}

/* الأزرار الثانوية (مثل تحديث) والشارات */
[data-theme="light"] [class*="bg-slate-700"],
[data-theme="light"] [class*="bg-gray-700"] {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
}

[data-theme="light"] .hover\:bg-slate-800:hover,
[data-theme="light"] .hover\:bg-slate-700:hover {
    background-color: #e2e8f0 !important;
}

/* الحدود والفواصل */
[data-theme="light"] [class*="border-slate-8"],
[data-theme="light"] [class*="border-slate-7"],
[data-theme="light"] [class*="border-gray-8"],
[data-theme="light"] [class*="border-gray-7"] {
    border-color: #cbd5e1 !important;
}

/* إصلاح تباين بطاقة "الإدراك" في الوضع الفاتح لتتناسق مع باقي البطاقات الأربع */
[data-theme="light"] #btn-open-engine {
    background-color: #fff1f2 !important;
    border-color: #fda4af !important;
    color: #be123c !important;
}
[data-theme="light"] #btn-open-engine:hover {
    background-color: #ffe4e6 !important;
}

/* تباين التبويبات الفرعية للمهام في الوضع الفاتح */
[data-theme="light"] .sub-tab-active {
    background-color: #ffffff !important;
    border-color: var(--accent-500) !important;
    color: var(--accent-400) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .sub-tab-inactive {
    color: #475569 !important;
}

/* 🌸 لمسة باستيل وردية ناعمة عند اقتران الوضع الفاتح بنمط كيتي 🎀 */
[data-theme="light"][data-robot-theme="kitty"] body,
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-slate-950"],
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-gray-950"] {
    background-color: #fdf2f8 !important;
    color: #1f1221 !important;
}

[data-theme="light"][data-robot-theme="kitty"] [class*="bg-slate-900"],
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-gray-900"],
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-zinc-900"] {
    background-color: #ffffff !important;
    box-shadow: 0 2px 14px rgba(219, 39, 119, 0.08);
}

[data-theme="light"][data-robot-theme="kitty"] [class*="bg-slate-800"],
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-gray-800"],
[data-theme="light"][data-robot-theme="kitty"] [class*="bg-zinc-800"] {
    background-color: #fff5f9 !important;
    border-color: #fbcfe8 !important;
}

[data-theme="light"][data-robot-theme="kitty"] [class*="border-slate-8"],
[data-theme="light"][data-robot-theme="kitty"] [class*="border-slate-7"],
[data-theme="light"][data-robot-theme="kitty"] [class*="border-gray-8"],
[data-theme="light"][data-robot-theme="kitty"] [class*="border-gray-7"] {
    border-color: #fbcfe8 !important;
}

[data-theme="light"][data-robot-theme="kitty"] .hover\:bg-slate-800:hover,
[data-theme="light"][data-robot-theme="kitty"] .hover\:bg-slate-700:hover {
    background-color: #fce7f3 !important;
}

/* النصوص بوضوح عالٍ (شاملة نصوص الإغلاق الشفافة داخل فقاعات التنبيه) */
[data-theme="light"] .text-white,
[data-theme="light"] .text-slate-100,
[data-theme="light"] .text-slate-200 {
    color: #0f172a !important;
}

[data-theme="light"] [class*="text-white/"] {
    color: rgba(15, 23, 42, 0.68) !important;
}

[data-theme="light"] .text-slate-300 { color: #334155 !important; }
[data-theme="light"] .text-slate-400,
[data-theme="light"] .text-gray-400  { color: #475569 !important; }
[data-theme="light"] .text-slate-500 { color: #64748b !important; }

/* البطاقات الملونة العلوية وفقاعات التنبيه والشارات (باستيل ناعم وواضح) */
[data-theme="light"] [class*="bg-emerald-9"],
[data-theme="light"] [class*="bg-green-9"],
[data-theme="light"] [class*="bg-teal-9"] {
    background-color: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
}

[data-theme="light"] [class*="bg-purple-9"],
[data-theme="light"] [class*="bg-violet-9"] {
    background-color: #f5f3ff !important;
    border-color: #c4b5fd !important;
}

[data-theme="light"] [class*="bg-blue-9"],
[data-theme="light"] [class*="bg-blue-8"],
[data-theme="light"] [class*="bg-sky-9"],
[data-theme="light"] [class*="bg-indigo-9"],
[data-theme="light"] [class*="bg-cyan-9"] {
    background-color: #eff6ff !important;
    border-color: #93c5fd !important;
}

[data-theme="light"] [class*="bg-amber-9"],
[data-theme="light"] [class*="bg-orange-9"],
[data-theme="light"] [class*="bg-yellow-9"] {
    background-color: #fffbeb !important;
    border-color: #fcd34d !important;
}

[data-theme="light"] [class*="bg-red-9"],
[data-theme="light"] [class*="bg-rose-9"] {
    background-color: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

[data-theme="light"] [class*="bg-pink-9"],
[data-theme="light"] [class*="bg-fuchsia-9"] {
    background-color: #fdf2f8 !important;
    border-color: #f9a8d4 !important;
}

/* تغميق جميع درجات النصوص الملونة (-100 إلى -400) فوق الخلفيات الفاتحة لضمان وضوح فقاعات التنبيه */
[data-theme="light"] .text-emerald-100,
[data-theme="light"] .text-emerald-200,
[data-theme="light"] .text-emerald-300,
[data-theme="light"] .text-emerald-400,
[data-theme="light"] .text-green-100,
[data-theme="light"] .text-green-200,
[data-theme="light"] .text-green-300,
[data-theme="light"] .text-green-400,
[data-theme="light"] .text-teal-100,
[data-theme="light"] .text-teal-200,
[data-theme="light"] .text-teal-300,
[data-theme="light"] .text-teal-400 { color: #047857 !important; }

[data-theme="light"] .text-purple-100,
[data-theme="light"] .text-purple-200,
[data-theme="light"] .text-purple-300,
[data-theme="light"] .text-purple-400,
[data-theme="light"] .text-violet-100,
[data-theme="light"] .text-violet-200,
[data-theme="light"] .text-violet-300,
[data-theme="light"] .text-violet-400 { color: #6d28d9 !important; }

[data-theme="light"] .text-blue-100,
[data-theme="light"] .text-blue-200,
[data-theme="light"] .text-blue-300,
[data-theme="light"] .text-blue-400,
[data-theme="light"] .text-sky-100,
[data-theme="light"] .text-sky-200,
[data-theme="light"] .text-sky-300,
[data-theme="light"] .text-sky-400,
[data-theme="light"] .text-indigo-100,
[data-theme="light"] .text-indigo-200,
[data-theme="light"] .text-indigo-300,
[data-theme="light"] .text-indigo-400,
[data-theme="light"] .text-cyan-100,
[data-theme="light"] .text-cyan-200,
[data-theme="light"] .text-cyan-300,
[data-theme="light"] .text-cyan-400 { color: #1d4ed8 !important; }

[data-theme="light"] .text-red-100,
[data-theme="light"] .text-red-200,
[data-theme="light"] .text-red-300,
[data-theme="light"] .text-red-400,
[data-theme="light"] .text-rose-100,
[data-theme="light"] .text-rose-200,
[data-theme="light"] .text-rose-300,
[data-theme="light"] .text-rose-400 { color: #b91c1c !important; }

[data-theme="light"] .text-pink-100,
[data-theme="light"] .text-pink-200,
[data-theme="light"] .text-pink-300,
[data-theme="light"] .text-pink-400,
[data-theme="light"] .text-fuchsia-100,
[data-theme="light"] .text-fuchsia-200,
[data-theme="light"] .text-fuchsia-300,
[data-theme="light"] .text-fuchsia-400 { color: #be185d !important; }

[data-theme="light"] .text-amber-100,
[data-theme="light"] .text-amber-200,
[data-theme="light"] .text-amber-300,
[data-theme="light"] .text-amber-400,
[data-theme="light"] .text-yellow-100,
[data-theme="light"] .text-yellow-200,
[data-theme="light"] .text-yellow-300,
[data-theme="light"] .text-yellow-400,
[data-theme="light"] .text-orange-100,
[data-theme="light"] .text-orange-200,
[data-theme="light"] .text-orange-300,
[data-theme="light"] .text-orange-400 { color: #92400e !important; }

/* حقول الإدخال */
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

[data-theme="light"][data-robot-theme="kitty"] input,
[data-theme="light"][data-robot-theme="kitty"] textarea,
[data-theme="light"][data-robot-theme="kitty"] select {
    border-color: #fbcfe8 !important;
}

/* الحفاظ على النص الأبيض فوق الأزرار الملونة القوية (شامل العناصر الداخلية) */
[data-theme="light"] .bg-brand-500,
[data-theme="light"] .bg-brand-600,
[data-theme="light"] .bg-blue-600,
[data-theme="light"] .bg-emerald-600,
[data-theme="light"] .bg-red-600,
[data-theme="light"] .bg-amber-600,
[data-theme="light"] .bg-pink-600,
[data-theme="light"] .bg-rose-600,
[data-theme="light"] .bg-brand-500 .text-white,
[data-theme="light"] .bg-brand-600 .text-white,
[data-theme="light"] .bg-blue-600 .text-white,
[data-theme="light"] .bg-emerald-600 .text-white,
[data-theme="light"] .bg-red-600 .text-white,
[data-theme="light"] .bg-amber-600 .text-white {
    color: #ffffff !important;
}

/* مسافة أمان أسفل الصفحة حتى لا يغطي شريط التنقل أزرار "المسار الذكي" و"اختيار" */
body {
    padding-bottom: 5.5rem !important;
}

/* ============================================================================
   🫧 3. نظام الواجهة المزدوجة: الوضع الكلاسيكي (classic) مقابل وضع الفقاعات (bubbles)
   ============================================================================ */

/* إخفاء عناصر وضع الفقاعات تماماً في الوضع الكلاسيكي (صفر تأثير على التصميم القديم) */
#bubbles-stage,
#btn-floating-daily-path,
#daily-path-sheet-backdrop,
#daily-path-sheet-handle,
#btn-minimize-daily-sheet {
    display: none;
}

/* حركات الطفو الهادئة للفقاعات العائمة */
@keyframes bubbleFloatA {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-7px); }
}

@keyframes bubbleFloatB {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

@keyframes micCorePulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow), 0 10px 28px var(--accent-glow); }
    50% { box-shadow: 0 0 0 14px rgba(0, 0, 0, 0), 0 12px 34px var(--accent-glow); }
}

/* --- تفعيل وضع الفقاعات العائمة --- */
[data-ui-mode="bubbles"] #classic-quick-actions {
    display: none !important;
}

/* ضمان ظهور معالج الإضافة اليدوية فوق المسرح والروبوت عند فتحه بالضغط المطول */
[data-ui-mode="bubbles"] #wizard-container:not(.hidden) {
    position: relative;
    z-index: 60;
}

[data-ui-mode="bubbles"] #bubbles-stage {
    /* حجم مرن يتكيف تلقائياً مع الهواتف الضيقة والعريضة والتابلت */
    --orb-size: clamp(50px, 15.5vw, 76px);
    display: flex;
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 1.5rem;
    background: radial-gradient(circle at 50% 36%, var(--accent-glow) 0%, transparent 52%);
}

[data-ui-mode="bubbles"][data-theme="light"] #bubbles-stage {
    background: radial-gradient(circle at 50% 36%, var(--accent-glow) 0%, rgba(255, 255, 255, 0) 50%);
}

/* ضبط موضع الهالة المركزية لتكون داخل الإطار وتخفيف حدتها */
[data-ui-mode="bubbles"] .bubbles-center-aura {
    top: 36% !important;
    opacity: 0.42 !important;
}

/* الفقاعات الزجاجية الأربعة مرتبة في قوس سفلي متقارب ومتكيّف مع عرض الشاشة */
.bubble-orb {
    position: absolute;
    width: var(--orb-size);
    height: var(--orb-size);
    border-radius: 9999px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(15, 23, 42, 0.72);
    border: 1.5px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    z-index: 25;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bubble-orb span:first-child {
    font-size: clamp(1.15rem, 4.4vw, 1.55rem);
    line-height: 1;
}

.bubble-orb span:last-child {
    font-size: clamp(9px, 2.5vw, 11px);
    line-height: 1.1;
}

.bubble-orb:hover,
.bubble-orb:active {
    animation-play-state: paused !important;
    transform: scale(1.08) !important;
    border-color: var(--accent-400);
    box-shadow: 0 0 24px var(--accent-glow), 0 12px 28px rgba(2, 6, 23, 0.5);
}

/* إحداثيات القوس السفلي المتكيّف */
.bubble-orb-1 {
    left: calc(50% + min(174px, 37.5%) - (var(--orb-size) / 2));
    bottom: 26%;
    animation: bubbleFloatA 4.6s ease-in-out infinite 0s;
}
.bubble-orb-3 {
    left: calc(50% + min(92px, 20.5%) - (var(--orb-size) / 2));
    bottom: 15.5%;
    animation: bubbleFloatB 4.9s ease-in-out infinite 0.5s;
}
.bubble-orb-2 {
    left: calc(50% - min(92px, 20.5%) - (var(--orb-size) / 2));
    bottom: 15.5%;
    animation: bubbleFloatB 5.1s ease-in-out infinite 1.0s;
}
.bubble-orb-4 {
    left: calc(50% - min(174px, 37.5%) - (var(--orb-size) / 2));
    bottom: 26%;
    animation: bubbleFloatA 5.4s ease-in-out infinite 0.3s;
}

[data-theme="light"] .bubble-orb {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(203, 213, 225, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.95);
}

[data-theme="light"][data-robot-theme="kitty"] .bubble-orb {
    background: rgba(255, 245, 249, 0.92);
    border-color: #fbcfe8;
    box-shadow: 0 10px 24px rgba(219, 39, 119, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.95);
}

/* زر الميكروفون المركزي في قلب القوس السفلي */
.bubble-mic-dock {
    position: absolute;
    bottom: 5.5%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 92%;
}

.bubble-mic-core {
    position: relative;
    width: clamp(62px, 18vw, 80px);
    height: clamp(62px, 18vw, 80px);
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    border: 2px solid var(--accent-300);
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    animation: micCorePulse 2.6s ease-in-out infinite;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

#btn-quick-new-task {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

.bubble-mic-core *,
#btn-quick-new-task * {
    pointer-events: none;
}

.bubble-mic-core:active {
    transform: scale(0.93);
}

/* الزر العائم السفلي «🏔️ مسار اليوم» + وضع الشريط الحي المصغر (Live Mini-Bar) */
[data-ui-mode="bubbles"] #btn-floating-daily-path {
    display: flex;
    position: fixed;
    bottom: 4.9rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 45;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-width: 190px;
    max-width: calc(100vw - 2rem);
    padding: 0.72rem 1.35rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.92);
    border: 1.5px solid var(--accent-500);
    color: #f8fafc;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.55), 0 0 18px var(--accent-glow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    cursor: pointer;
}

[data-ui-mode="bubbles"] #btn-floating-daily-path:active {
    transform: translateX(-50%) scale(0.96);
}

[data-ui-mode="bubbles"][data-theme="light"] #btn-floating-daily-path {
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    border-color: var(--accent-500);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), 0 0 14px var(--accent-glow);
}

[data-ui-mode="bubbles"] #btn-floating-daily-path.live-mini-bar {
    width: calc(100vw - 2rem);
    max-width: 440px;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    border-radius: 1.15rem;
}

/* إخفاء الزر العائم عندما يكون الدرج مفتوحاً أو عندما نكون في تبويب المهام */
[data-ui-mode="bubbles"] #btn-floating-daily-path.floating-trigger-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

/* خلفية مظللة خلف نافذة مسار اليوم في وضع الفقاعات */
[data-ui-mode="bubbles"] #daily-path-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 48;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

[data-ui-mode="bubbles"] #daily-path-sheet-backdrop.sheet-open {
    opacity: 1;
    pointer-events: auto;
}

/* تمدد بطاقة «مسار اليوم» بكامل المساحة المتاحة من أسفل الهيدر مباشرة حتى أعلى شريط التنقل */
[data-ui-mode="bubbles"] #daily-path-sheet {
    position: fixed !important;
    top: 4.5rem;
    bottom: 4.75rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: calc(100% - 1rem);
    max-width: 56rem;
    height: auto;
    min-height: 0;
    max-height: none;
    z-index: 50;
    border-radius: 1.25rem !important;
    padding-bottom: 1rem !important;
    transform: translateY(32px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
    box-shadow: 0 20px 55px rgba(2, 6, 23, 0.65), 0 0 28px var(--accent-glow);
}

[data-ui-mode="bubbles"] #daily-path-sheet.sheet-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

[data-ui-mode="bubbles"][data-theme="light"] #daily-path-sheet {
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 0 24px var(--accent-glow);
}

[data-ui-mode="bubbles"] #daily-path-sheet-handle {
    display: flex;
    justify-content: center;
    padding-top: 2px;
    padding-bottom: 6px;
}

[data-ui-mode="bubbles"] #btn-minimize-daily-sheet {
    display: inline-flex;
}
/* ============================================================================
   🛡️ 4. حماية الفقاعات والتنبيهات من الخروج خارج إطار شاشة الهاتف (Viewport Guard)
   ============================================================================ */

/* 1) تثبيت فقاعة الروبوت بشكل مطلق فوقه دون دفعه للأسفل أو الخروج من الشاشة */
#floating-robot-companion #floating-robot-bubble {
    position: absolute !important;
    bottom: calc(100% + 12px) !important;
    width: min(285px, calc(100vw - 2rem)) !important;
    max-width: calc(100vw - 2rem) !important;
    margin-bottom: 0 !important;
    z-index: 70 !important;
}

/* في الوضع الكبير (المنتصف): توسيط الفقاعة أفقياً */
#floating-robot-companion.robot-hero-active #floating-robot-bubble {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

/* في الوضع المصغّر (أسفل اليسار): محاذاة الفقاعة من اليسار لتمتد داخل الشاشة */
#floating-robot-companion:not(.robot-hero-active) #floating-robot-bubble {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
}

/* 2) تقييد جميع فقاعات التنبيه (Toasts) داخل إطار الهاتف وتحت الشريط العلوي */
#toast-container,
.toast-container {
    position: fixed !important;
    top: max(4.25rem, calc(env(safe-area-inset-top, 0px) + 3.5rem)) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: min(420px, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
    z-index: 99999 !important;
    pointer-events: none;
}

#toast-container > *,
.toast-container > * {
    max-width: 100% !important;
    word-break: break-word;
    pointer-events: auto;
}
@keyframes mmfNeedleIdle {
    0%, 100% { transform: rotate(42deg); }
    50% { transform: rotate(48deg); }
}

@keyframes mmfTipPulse {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
}

@keyframes mmfRingSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mmf-needle-motion {
    transform-origin: 32px 32px;
    animation: mmfNeedleIdle 4.5s ease-in-out infinite;
}

.mmf-tip-motion {
    animation: mmfTipPulse 2.4s ease-in-out infinite;
}

.mmf-ring-motion {
    transform-origin: 32px 32px;
    animation: mmfRingSlow 28s linear infinite;
}