
        :root {
            --primary: #334155;
            --z-color: #2196f3; --z-bg: #e3f2fd;
            --h-color: #e0409a; --h-bg: #fde7f2;   /* 29.09.2026 — ורוד ברור, לא בורדו */
            --t-color: #8e44ad; --t-bg: #f3e8f8;   /* 30.09.2026 — סגול בהיר, כמו התכלת של ז והוורוד של ח (היה אפור, בצבע הרקע) */
            --general-color: #7f8c8d; --general-bg: #f8faf9;
            --teachers-color: #2e7d32; --teachers-bg: #e7f4ed; 
            --off-color: #e67e22;
            --leaf-green: #68a824;
            --grey-text: #475569;
        }

        body { font-family: 'Segoe UI', Tahoma, sans-serif; background: #eef1f4; margin: 0; padding: 8px; line-height: 1.3; }
        button, input, select, textarea, optgroup { font-family: inherit; }
        
        .container { 
            max-width: 950px; 
            margin: auto; 
            background: #eef1f4;
            border-radius: 14px;
            box-shadow: 0 5px 25px rgba(0,0,0,0.1);
            overflow: clip;
            min-height: 85vh;
        }
        @media (min-width: 1400px) {
            .container { max-width: 1200px; }
        }

        /* --- הבחנה ויזואלית בין מצבים (תלמידים/הורים מול מורים) --- */
        #mainMenuView {
            background-color: #e7f4ed;
            border-top: 4px solid #008354;
            transition: background-color .35s ease, border-color .35s ease;
        }
        #mainMenuView.menu-mode-teachers {
            background-color: #eef1f4;
        }

        /* --- דף הבית --- */
        #mainMenuView { padding: 46px 24px; text-align: center; background: #eef1f4; }
        .welcome-text { font-size: 1.8rem; color: var(--grey-text); font-weight: 900; margin-bottom: 12px; text-align: center; }
        .welcome-inline-icon { display: none; }
        .portal-title { color: var(--grey-text); font-size: 2.8rem; margin: 0 0 6px 0; font-weight: 900; text-align: center; line-height: 1.1; }
        .portal-title-main {
            display: block;
            white-space: normal;
        }
        .portal-title-brand {
            display: block;
            margin-top: 8px;
            font-size: 1.25em;
            white-space: normal;
        }
        .portal-title-brand-text {
            display: inline-block;
        }
        .portal-title .title-word {
            display: inline-block;
            margin: 0 0.12em;
            letter-spacing: 0.01em;
            text-shadow: 0 1px 0 rgba(255,255,255,0.2), 0 2px 6px rgba(99, 140, 33, 0.08);
            filter: saturate(1.06);
        }
        .portal-title .green-1 { color: #5aa228; }
        .portal-title .green-2 { color: var(--primary); }
        .portal-title .green-3 { color: var(--primary); }
        .portal-title .green-4 { color: #5aa228; }

        .menu-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; grid-template-rows: auto; }
        .menu-card { 
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border: 2px solid #cbd5e1;
            border-radius: 24px;
            padding: 18px 15px;
            font-size: 1.35rem;
            font-weight: 900;
            color: var(--primary);
            text-decoration: none;
            cursor: pointer;
            transition: 0.25s;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            min-height: 204px;
            width: min(100%, 274px);
            aspect-ratio: 1 / 1;
            justify-self: center;
            box-sizing: border-box;
            box-shadow: 0 8px 18px rgba(0,0,0,0.08);
            position: relative;
            z-index: 1;
        }
        .menu-card:hover { transform: translateY(-2px); border-color: #aeb9c2; box-shadow: 0 12px 24px rgba(0,0,0,0.1); }
        .menu-card-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
        }
        .menu-card-title {
            font-size: 1.35rem;
            font-weight: 900;
            color: var(--primary);
            line-height: 1.1;
        }
        .menu-card-title.with-lock > span:last-child {
            display: inline-block;
        }
        .menu-card-title.with-lock {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            flex-wrap: nowrap;
            direction: rtl;
            text-align: center;
            width: 100%;
        }
        .portal-lock-inline {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 22px;
            height: 22px;
            padding: 0;
            border-radius: 0;
            background: transparent;
            border: none;
            color: #475569;
            font-size: 0.95rem;
            font-weight: 900;
            line-height: 1;
            box-shadow: none;
            white-space: nowrap;
            flex: 0 0 22px;
        }
        .menu-card-subtitle {
            font-size: 0.7rem;
            font-weight: 800;
            color: #5b6675;
            letter-spacing: 0;
            line-height: 1.55;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 7px;
            margin-top: 16px;
        }
        .menu-card-topline {
            font-size: inherit;
            font-weight: inherit;
            color: inherit;
            margin-bottom: 0;
        }
        .menu-card-subtitle-line {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 4px;
            font-size: inherit;
            font-weight: inherit;
            color: inherit;
            line-height: inherit;
        }
        .menu-card-subtitle-line > span:not(.menu-card-dot) {
            display: inline-flex !important;
            align-items: center;
            font: inherit;
            color: inherit;
            line-height: inherit;
        }
        
        .menu-card-mini-square-logo {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 14px;
            height: 14px;
            border-radius: 4px;
            overflow: hidden;
            box-shadow: 0 1px 2px rgba(0,0,0,0.12);
            flex: 0 0 14px;
        }
        .menu-card-mini-square-logo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .menu-card-highlight {
            font-size: 1.42em;
            font-weight: 900;
            line-height: 1.08;
        }
        .menu-card-dot {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin: 0 3px;
            line-height: 1;
        }
        .menu-card-dot img {
            width: 12px;
            height: 12px;
            object-fit: contain;
            opacity: 0.92;
            filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
        }
        .center-logo { display: flex; justify-content: center; align-items: center; grid-column: 2 / 3; grid-row: 1 / 2; padding: 0 8px; align-self: center; }
        .students-card { grid-column: 1 / 2; grid-row: 1 / 2; }
        .teachers-card { grid-column: 3 / 4; grid-row: 1 / 2; }
        
        /* העיצוב לאייקון המקורי */
        .app-icon {
            width: 150px; 
            height: 150px;
            object-fit: contain; 
        }
        
        .title-logo-header { display: inline-block; width: 45px; height: 45px; vertical-align: middle; margin-right: 6px; position: relative; top: -4px; }


        .app-icon {
            animation: pulseZoom 2.8s ease-in-out infinite;
            transform-origin: center center;
        }

        @keyframes pulseZoom {
            0% { transform: scale(1); }
            50% { transform: scale(1.12); }
            100% { transform: scale(1); }
        }

        @keyframes welcomeIconFloat {
            0% { transform: translateY(0) scale(1); }
            50% { transform: translateY(-2px) scale(1.06); }
            100% { transform: translateY(0) scale(1); }
        }


        .home-quote {
            margin-top: 14px;
            color: var(--grey-text);
            font-size: 1.8rem;
            font-weight: 900;
            text-align: center;
            line-height: 1.3;
            max-width: 480px;
        }

        /* בורר קהל (תלמידים/מורים) + רשת אריחים — מיתוג ירוק */
        /* שורת השם מעל הלוגו והסיסמה מתחתיו.
           עד עכשיו המילים "חטיבת הנעורים" היו חלק מקובץ התמונה ולא היה
           אפשר לערוך אותן. עכשיו התמונה מכילה רק את כתב היד "דמו",
           והשאר הוא טקסט. */
        /* שתי שורות הטקסט מיושרות לקצות של כתב היד עצמו.
           כדי שזה יעבוד, הכותרת מצומצמת לרוחב התמונה במקום למלוא השורה,
           ואז "ימינה" ו"שמאלה" הם ה-ב וה-ת של דמו. */
        .portal-title { width: fit-content; margin-left: auto; margin-right: auto; }
        .portal-kicker {
            display: block; font-size: 21px; font-weight: 900; color: #000;
            letter-spacing: -.3px; line-height: 1.15; margin: 0 0 2px;
            /* מוזז פנימה מה-ב כלפי שמאל. אחוזים ולא פיקסלים,
               כדי שהיחס יישמר בכל רוחב מסך. */
            text-align: right; padding-left: 0; padding-right: 10%;
        }
        /* צמודה לכתב היד שמעליה — מרווח שלילי, כי לקובץ
           הלוגו יש שוליים פנימיים שלא ניתן לחתוך בלי לפגוע באותיות. */
        .portal-motto {
            display: block; font-family: 'Gveret Levin', cursive;
            font-size: 15px; color: #1a1a1a; line-height: 1.1; margin: -20px 0 0;
            /* מוזז פנימה מה-ת כלפי ימין. */
            font-weight: 400; text-align: left; padding-left: 13%; padding-right: 0;
        }
        #portalLogoImg { display: block; margin: 0 auto; }
        @media (max-width: 420px) {
            .portal-kicker { font-size: 19px; }
            .portal-motto { font-size: 13px; margin-top: -17px; }
        }
        .home-aud-seg {
            display: flex; gap: 6px; max-width: 420px; margin: 0 auto 18px;
            background: #eef1f4; border: 1px solid #cbd5e1; border-radius: 999px; padding: 5px;
        }
        .home-aud-btn {
            flex: 1; border: none; background: transparent; border-radius: 999px;
            padding: 10px 8px; font-size: 13px; font-weight: 800; cursor: pointer;
            color: #5b6675; display: flex; align-items: center; justify-content: center; gap: 6px;
            font-family: inherit; transition: background .15s ease, color .15s ease;
            line-height: 1.2; text-align: center; white-space: nowrap;
        }
        .home-aud-btn.on { background: #64748b; color: #fff; box-shadow: 0 1px 4px rgba(100,116,139,0.30); }
        #homeAudTeachers.on { background: #64748b; box-shadow: 0 1px 4px rgba(100,116,139,0.30); }
        #homeAudStudents { border: 2px solid #008354; box-sizing: border-box; }
        #homeAudTeachers { border: 2px solid #64748b; box-sizing: border-box; }
        #homeAudStudents.on { background:#008354; box-shadow:0 1px 5px rgba(0,131,84,0.40); }
        #homeAudStudents.on .hub-mark { color:#ecfdf5; }
        .hub-mark { font-family:'Kaushan Script',cursive; color:#008354; font-weight:700; letter-spacing:0; }
        .home-aud-btn.on .hub-mark { color:#bff0d8; }
        /* כניסה לאזור אחראי/ת מערכת. אינו קהל אלא כלי — הוא פותח חלון
           ואינו נשאר "דלוק", ולכן הוא צר, בצבע אחר, ובלי מצב .on. */
        #homeAudSys {
            flex: 0 0 46px; padding: 10px 0; font-size: 17px;
            border: 2px solid #cbd5cf; box-sizing: border-box;
            background: #ffffff; color: #64748b;
        }
        #homeAudSys:hover { background: #eef1f4; border-color: #b6c4bd; }
        .home-aud-hint {
            text-align: center; font-size: 12px; color: #6b7280; margin: 0 auto 16px; font-weight: 600;
        }
        #tvPreviewBar {
            display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
            max-width: 480px; margin: -8px auto 16px;
        }
        #tvPreviewBtn {
            border: 1.5px solid #f0d9a8; background: #fdf0d5; color: #8a6412; border-radius: 999px;
            padding: 5px 13px; font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
        }
        #tvPreviewBtn.tv-on { border-color: #cfe8dd; background: #e7f4ed; color: #00623f; }
        .home-tiles {
            display: flex; flex-direction: column; gap: 15px;
            max-width: 480px; margin: 0 auto;
        }
        .home-group { display: flex; flex-direction: column; gap: 7px; }
        .home-group-title {
            display: inline-flex; align-items: center; align-self: center;
            width: fit-content;
            background: linear-gradient(135deg, #7cc0a6 0%, #69b196 100%);
            border: 1.5px solid #57a288; color: #ffffff;
            border-radius: 999px; padding: 5px 16px; margin: 2px 0 0;
            font-size: 13px; font-weight: 900; letter-spacing: 0.2px;
        }
        .home-group-grid {
            display: flex; flex-wrap: wrap; justify-content: center; gap: 9px;
        }
        .home-group-grid .home-tile { flex: 0 0 92px; box-sizing: border-box; }
        /* חותמת "ייתכנו שינויים" בפינה השמאלית העליונה של אריח המערכת
           השבועית. באלכסון ובירוק של דמו, קטנה מספיק כדי לא להתחרות
           בשם האריח, ולא לוכדת לחיצות. */
        .fx-tile-note {
            position: absolute; top: 12px; left: 1px; transform: rotate(-20deg);
            transform-origin: left top; width: 34px; text-align: center;
            /* פונט כתב יד עברי מ-Google Fonts. אחריו נפילה לכתבי יד של
               מערכות ההפעלה, ולבסוף cursive הגנרי. */
            font-family: 'Gveret Levin', 'Amatic SC', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', cursive;
            color: #008354; font-size: 9px; font-weight: 400; line-height: 1.05;
            pointer-events: none;
        }
        /* האייקון של האריח הזה קטן במעט, כדי שהחותמת תיכנס בפינה בלי
           לגעת בו. */
        [data-tile="fixedsched"] .home-tile-ico { font-size: 22px; }
        .home-tile {
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
            background: #fff; border: 1px solid #e3ead7; border-radius: 12px; padding: 10px 4px;
            cursor: pointer; font-family: inherit; color: #334155; text-align: center;
            transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
        }
        /* אריח שמוסתר מהקהל הנוכחי ומוצג רק לאחראית המערכת. בלי הסימון
           הזה אין שום דרך לדעת שהאריח שאת רואה אינו מוצג לאף אחת אחרת. */
        .home-tile.tv-admin-only { position: relative; border-style: dashed; border-color: #d8b46a; background: #f8faf9; }
        .home-tile.tv-admin-only::after {
            content: 'מוסתר'; position: absolute; top: 4px; inset-inline-end: 5px;
            background: #fdf0d5; color: #8a6412; border: 1px solid #f0d9a8; border-radius: 999px;
            padding: 0 5px; font-size: 8px; font-weight: 800; line-height: 1.5; letter-spacing: .2px;
        }
        /* אריח במצב עדכון. נשאר במקומו ונראה כרגיל — רק מעט מעומעם,
           כדי שלא ייראה מקולקל אצל תלמיד או הורה שלא יודע כלום על
           העדכון. ההודעה מגיעה בלחיצה. */
        .home-tile.tv-maint .home-tile-ico,
        .home-tile.tv-maint .home-tile-label { opacity: .62; }
        .home-tile:hover { border-color: #c2dca0; box-shadow: 0 3px 10px rgba(90,162,40,0.10); }
        .home-tile:active { transform: scale(0.97); }
        /* ההודעה שנפתחת בלחיצה על אריח שבמצב עדכון. */
        #tvMaintModal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.6);
            z-index: 21800; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
        #tvMaintModal.on { display: flex; }
        #tvMaintModal .tvm-box { background: #fff; width: 100%; max-width: 340px; border-radius: 16px;
            padding: 24px 18px 16px; text-align: center; direction: rtl;
            font-family: 'Heebo','Segoe UI',Tahoma,sans-serif; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
        #tvMaintModal .tvm-ico { font-size: 36px; line-height: 1; margin-bottom: 8px; }
        #tvMaintModal .tvm-title { font-size: 17px; font-weight: 900; color: #008354; margin-bottom: 7px; }
        #tvMaintModal .tvm-sub { font-size: 13px; color: #5b6675; line-height: 1.7; margin-bottom: 16px; }
        #tvMaintModal .tvm-ok { width: 100%; padding: 11px; border: none; border-radius: 10px;
            background: #008354; color: #fff; font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
        .home-tile-ico { font-size: 26px; line-height: 1; }
        .home-tile-logo { width: 26px; height: 26px; object-fit: contain; display: block; }
        .home-tile-sub { font-size: 9px; font-weight: 700; color: #111318; line-height: 1.15; margin-top: -3px; }
        /* אותו גודל, פונט וצבע כמו החותמת "ייתכנו שינויים". */
        .home-tile-sub.tile-sub-hand {
            font-family: 'Gveret Levin', 'Amatic SC', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', cursive;
            font-size: 9px; font-weight: 400; color: #008354;
        }
        .home-tile-logo-wide { width: auto; height: 22px; max-width: 72px; }
        .home-tile-label { font-size: 11px; font-weight: 800; line-height: 1.2; }
        .home-tile-blink { box-shadow: 0 0 0 3px rgba(47,158,110,0.28); }
        @keyframes homeTileBlink {
            0%, 100% { box-shadow: 0 0 0 0 rgba(47,158,110,0.55); }
            50% { box-shadow: 0 0 0 5px rgba(47,158,110,0); }
        }
        .home-tile-primary { background: linear-gradient(135deg, #7cc0a6 0%, #69b196 100%); border: 2px solid #57a288; grid-column: span 3; flex-direction: row; gap: 13px; padding: 20px 16px; animation: homePrimaryPulse 2s ease-in-out infinite; }
        .home-tile-primary:hover { animation-play-state: paused; }
        @keyframes homePrimaryPulse {
            0%, 100% { transform: scale(1); box-shadow: 0 2px 10px rgba(0,131,84,0.22); }
            50%      { transform: scale(1.06); box-shadow: 0 12px 32px rgba(0,131,84,0.55); }
        }
        /* pulse plays regardless of reduced-motion (per request) */
        .home-tile-primary .home-tile-ico { font-size: 34px; }
        .home-tile-banner-ico { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; display: block; flex: none; }
        .home-tile-logo-mashov { height: 22px; width: auto; max-width: 64px; object-fit: contain; display: block; }
        .home-tile-primary .home-tile-label { font-size: 18px; color: #f8faf9; }
        .home-mode-teachers .home-tile-primary { background: linear-gradient(135deg, #7cc0a6 0%, #69b196 100%); border: 2px solid #57a288; animation-name: homePrimaryPulseGray; }
        .home-mode-teachers .home-tile-primary .home-tile-label { color: #f8faf9; }
        @keyframes homePrimaryPulseGray {
            0%, 100% { transform: scale(1); box-shadow: 0 2px 10px rgba(0,131,84,0.22); }
            50%      { transform: scale(1.06); box-shadow: 0 12px 32px rgba(0,131,84,0.55); }
        }
        .home-tile-teachers { display: none; }
        .home-tile-admin { display: none; }

        /* --- תצוגת "עץ"/תרשים זרימה: כל נושא = ענף אופקי שממנו יורדים ענפים אנכיים קצרים לאריחים --- */
        .home-tree { gap: 2px; }
        .home-tree .home-group { align-items: center; gap: 0; }
        .home-tree .home-group-title { align-self: center; position: relative; margin-top: 22px; }
        .home-tree .home-group-title::before { content:""; position:absolute; left:50%; transform:translateX(-50%); top:-22px; width:2px; height:22px; background:#57a288; }
        .home-tree .home-group-title::after { content:""; position:absolute; left:50%; transform:translateX(-50%); bottom:-14px; width:2px; height:14px; background:#57a288; }
        .home-tree .home-group:first-child .home-group-title { margin-top: 12px; }
        .home-tree .home-group:first-child .home-group-title::before { top:-12px; height:12px; }
        .home-tree .home-group-grid { display:flex; flex-wrap:nowrap; align-items:flex-start; justify-content:center; gap:8px; margin-top:14px; padding:0 4px; overflow-x:auto; }
        .home-tree .home-tile { position:relative; margin-top:16px; width:62px; padding:9px 3px; gap:5px; border-radius:12px; flex:0 0 auto; }
        .home-tree .home-tile::before { content:""; position:absolute; top:-16px; right:50%; width:50%; height:16px; border-top:2px solid #57a288; border-right:2px solid #57a288; }
        .home-tree .home-tile::after { content:""; position:absolute; top:-16px; left:50%; width:50%; height:16px; border-top:2px solid #57a288; }
        .home-tree .home-tile:first-child::before { border-top-color:transparent; }
        .home-tree .home-tile:last-child::after, .home-tree .home-tile.tree-last::after { border-top-color:transparent; }
        .home-tree .home-tile:only-child::after { display:none; }
        .home-tree .home-tile-logo { width: 22px; height: 22px; }
        .home-tree .home-tile-logo-wide { height: 19px; max-width: 54px; }
        .home-tree .home-tile-logo-mashov { height: 19px; max-width: 52px; }
        .home-tree .home-tile-ico { font-size: 22px; }
        .home-tree .home-tile-label { font-size: 10px; font-weight: 800; }
        .home-tile-ti { font-size: 22px; line-height: 1; color: #008354; display: block; }
        .home-tree .home-tile-ti { font-size: 22px; }

        /* ===== תצוגת מחשב — אריחים גדולים, וכל קטגוריה בשורה אחת =====
           הרוחב המקסימלי של 480 פיקסל נועד למובייל. במסך רחב הוא מוגדל,
           והאריחים גדלים איתו, כך שכל קבוצה נכנסת לשורה אחת. flex-wrap
           נשאר פעיל, ולכן כשבאמת אין מקום — השורה נשברת מעצמה. */
        @media (min-width: 900px) {
            .home-tiles:not(.home-tree) { max-width: 1180px; gap: 22px; }
            .home-tiles:not(.home-tree) .home-group { gap: 10px; }
            .home-tiles:not(.home-tree) .home-group-title { font-size: 15px; padding: 6px 20px; }
            .home-tiles:not(.home-tree) .home-group-grid { gap: 14px; }
            /* גודל גמיש: האריחים מתרחבים למלא את השורה ומתכווצים כדי להיכנס אליה.
               רק כשהרוחב יורד מתחת למינימום הקריא — flex-wrap שובר לשורה נוספת. */
            .home-tiles:not(.home-tree) .home-group-grid .home-tile {
                flex: 1 1 104px; min-width: 96px; max-width: 168px;
                padding: 16px 8px; gap: 9px; border-radius: 16px;
            }
            .home-tiles:not(.home-tree) .home-tile-ico { font-size: 36px; }
            .home-tiles:not(.home-tree) .home-tile-ti  { font-size: 32px; }
            .home-tiles:not(.home-tree) .home-tile-logo { width: 36px; height: 36px; }
            .home-tiles:not(.home-tree) .home-tile-logo-wide { height: 30px; max-width: 100px; }
            .home-tiles:not(.home-tree) .home-tile-logo-mashov { height: 30px; max-width: 88px; }
            .home-tiles:not(.home-tree) .home-tile-label { font-size: 14px; }
            .home-tiles:not(.home-tree) .home-tile-sub { font-size: 11px; }
            .home-tiles:not(.home-tree) .home-tile-primary { flex: 1 1 100%; }
            .home-tiles:not(.home-tree) .home-tile-primary .home-tile-ico { font-size: 44px; }
            .home-tiles:not(.home-tree) .home-tile-primary .home-tile-label { font-size: 22px; }
        }
        @media (min-width: 1400px) {
            .home-tiles:not(.home-tree) { max-width: 1320px; }
            .home-tiles:not(.home-tree) .home-group-grid .home-tile { max-width: 184px; }
        }
        @media (max-width: 420px) {
            .home-tiles { gap: 12px; }
            .home-group-grid { gap: 9px; }
            .home-tile { padding: 9px 3px; border-radius: 12px; }
            .home-tile-ico { font-size: 20px; }
            .home-tile-ti { font-size: 20px; }
        }

        .notify-entry-btn {
            display: block; margin: 10px auto 6px; padding: 10px 20px;
            background: #fff; border: 1.5px solid #cbd5e1; border-radius: 20px;
            color: #334155; font-size: 14px; font-weight: 800; cursor: pointer;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06); font-family: inherit;
        }
        .notify-entry-btn:hover { background: #f8faf9; border-color: #9fb6d4; }

        /* ───── כרטיס "סרטון היכרות" מעל האריחים ─────
           מוצג לתלמידים ולהורים בלבד, ונעלם אחרי "כבר צפיתי".
           המצב נשמר ב-localStorage; האריח ב"מידע שימושי" נשאר תמיד. */
        .tour-card {
            display: none; align-items: center; gap: 11px;
            max-width: 440px; margin: 10px auto 4px; padding: 8px 11px;
            background: linear-gradient(135deg, #06432d 0%, #0a6b47 62%, #078a58 100%);
            border-radius: 14px; box-shadow: 0 5px 14px rgba(4,48,31,.26);
            text-align: center; direction: rtl; position: relative; overflow: hidden;
        }
        .tour-card.show { display: flex; }
        .tour-card-thumb {
            flex: 0 0 82px; width: 82px; height: 47px; border-radius: 8px;
            background: #04301f center/cover no-repeat; position: relative; cursor: pointer;
            border: 1px solid rgba(255,255,255,.22);
        }
        .tour-card-thumb::after {
            content: '\25B6'; position: absolute; inset: 0; display: flex;
            align-items: center; justify-content: center; font-size: 16px;
            color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6);
        }
        .tour-card-txt { flex: 1 1 auto; min-width: 0; text-align: center; }
        .tour-card-ttl { font-size: 13px; font-weight: 900; color: #fff; line-height: 1.25; }
        .tour-card-sub { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.78); margin-top: 2px; }
        .tour-card-go {
            padding: 5px 14px; border: none; border-radius: 999px;
            background: #fff; color: #06432d; font-size: 12px; font-weight: 900;
            cursor: pointer; font-family: inherit; flex: 0 0 auto;
        }
        .tour-card-go:hover { background: #e7f4ed; }
        .tour-card-acts { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
        .tour-card-x {
            background: none; border: none; color: rgba(255,255,255,.66);
            font-size: 11px; font-weight: 700; cursor: pointer;
            font-family: inherit; padding: 3px 2px; text-decoration: underline;
        }
        .tour-card-x:hover { color: #fff; }
        @media (max-width: 420px) {
            .tour-card { gap: 9px; padding: 7px 9px; }
            .tour-card-thumb { flex: 0 0 68px; width: 68px; height: 39px; }
            .tour-card-ttl { font-size: 12px; }
            .tour-card-sub { font-size: 11px; }
        }
        .notify-grade-block {
            border: 1px solid #e2e8f0; border-radius: 12px; padding: 7px 10px; margin-bottom: 7px;
            background: #ffffff; direction: rtl;
        }
        .notify-grade-head {
            display: flex; align-items: center; gap: 8px; font-weight: 800;
            font-size: 13px; color: #334155; margin-bottom: 5px;
        }
        .notify-grade-head input { width: 17px; height: 17px; }
        .notify-class-grid { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 4px; }
        .notify-class-chip {
            display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
            background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
            padding: 4px 8px; cursor: pointer; color: #34495e; font-weight: 600;
        }
        .notify-class-chip input { width: 15px; height: 15px; }

        .site-credit {
            margin: 24px auto 4px;
            color: #6b7280;
            font-size: 1rem;
            font-weight: 700;
            text-align: center;
            line-height: 1.5;
            max-width: 620px;
            padding: 0 12px;
        }


        .site-credit-location {
            margin: 2px auto 0;
            color: #6b7280;
            font-size: 0.8rem;
            font-weight: 600;
            text-align: center;
            line-height: 1.35;
            max-width: 620px;
            padding: 0 12px;
        }

        .sync-status-wrap {
            display: flex;
            justify-content: center;
            margin: 10px 0 0;
            min-height: 36px;
        }

        .sync-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 7px 12px;
            border-radius: 999px;
            background: rgba(255,255,255,0.78);
            border: 1px solid rgba(207,214,220,0.92);
            box-shadow: 0 6px 14px rgba(0,0,0,0.05);
            color: #5b6675;
            font-size: 0.8rem;
            font-weight: 800;
            line-height: 1;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
            white-space: nowrap;
        }

        .sync-status-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #9aa3ad;
            box-shadow: 0 0 0 3px rgba(154,165,177,0.16);
            flex: 0 0 9px;
            transition: background 0.2s ease, box-shadow 0.2s ease;
        }

        .sync-status-badge.sync-checking .sync-status-dot,
        .sync-status-badge.sync-syncing .sync-status-dot {
            background: #68a824;
            box-shadow: 0 0 0 4px rgba(104,168,36,0.18);
            animation: syncPulse 1.2s ease-in-out infinite;
        }

        .sync-status-badge.sync-synced .sync-status-dot {
            background: #2e7d32;
            box-shadow: 0 0 0 4px rgba(46,125,50,0.14);
            animation: none;
        }

        .sync-status-badge.sync-error {
            color: #b45309;
            background: rgba(255,247,237,0.94);
            border-color: rgba(245,158,11,0.34);
        }

        .sync-status-badge.sync-error .sync-status-dot {
            background: #f59e0b;
            box-shadow: 0 0 0 4px rgba(245,158,11,0.14);
            animation: none;
        }

        @keyframes syncPulse {
            0% { transform: scale(1); opacity: 0.9; }
            50% { transform: scale(1.16); opacity: 1; }
            100% { transform: scale(1); opacity: 0.9; }
        }

        .mobile-bottom-icon {
            display: none;
        }

        /* --- לב מהבהב למורות --- */
        @keyframes pulseBadge {
            0% { transform: scale(1); }
            50% { transform: scale(1.25); }
            100% { transform: scale(1); }
        }
        
        .team-btn { position: relative; }
        .teacher-badge-small {
            position: absolute;
            top: -10px;
            right: -6px;
            font-size: 1.1rem;
            animation: pulseBadge 1.5s infinite ease-in-out;
            pointer-events: none;
            filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
            z-index: 2;
        }

        /* --- לוח שנה --- */
        #calendarView { display: none; }
        .top-controls-wrapper {
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border-bottom: 1px solid #e2e8f0;
            padding: 8px 10px 10px;
        }
        .admin-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 6px; flex-wrap: wrap; }
        .main-filters { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
        .main-filters, .grade-class-filter-bar { scrollbar-width: none; }
        .main-filters::-webkit-scrollbar, .grade-class-filter-bar::-webkit-scrollbar { display: none; }

        .filter-btn {
            border: 2px solid #ddd;
            background: white;
            padding: 6px 15px;
            border-radius: 24px;
            cursor: pointer;
            font-weight: 900;
            font-size: 0.9rem;
            transition: 0.2s;
            font-family: inherit;
        }

        .top-controls-wrapper .filter-btn,
        .header .nav-btn,
        .header .view-toggle button {
            border: none;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            padding: 6px 10px;
            border-radius: 16px;
            cursor: pointer;
            font-weight: 900;
            font-size: 0.8rem;
            transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
            font-family: inherit;
            min-height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            color: #223041;
            box-shadow: 0 8px 18px rgba(15,23,42,0.08), inset 0 0 0 1px rgba(148,163,184,0.2);
        }

        .top-controls-wrapper .filter-btn:hover,
        .header .nav-btn:hover,
        .header .view-toggle button:hover {
            transform: translateY(-1px);
            box-shadow: 0 14px 28px rgba(15,23,42,0.12), inset 0 0 0 1px rgba(148,163,184,0.18);
        }

        .top-app-btn { position: relative; }

        .protected-btn .lock-badge {
            position: absolute;
            top: -4px;
            left: 6px;
            width: 16px;
            height: 16px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: rgba(241,245,249,0.42);
            border: 1px solid rgba(255,255,255,0.72);
            box-shadow: 0 4px 10px rgba(15,23,42,0.14);
            backdrop-filter: blur(5px);
            -webkit-backdrop-filter: blur(5px);
            color: rgba(71,85,105,0.95);
            pointer-events: none;
            z-index: 3;
        }

        .protected-btn .lock-badge svg {
            width: 9px;
            height: 9px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .protected-btn:hover .lock-badge {
            background: rgba(241,245,249,0.52);
            border-color: rgba(255,255,255,0.82);
        }


        .btn-icon {
            width: 22px;
            height: 22px;
            border-radius: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: 900;
            color: white;
            background: linear-gradient(135deg, var(--btn-accent, #64748b), color-mix(in srgb, var(--btn-accent, #64748b) 68%, white));
            box-shadow: 0 7px 14px rgba(15,23,42,0.14);
            flex-shrink: 0;
        }

        .btn-text { white-space: nowrap; display: inline-block; }

        .btn-edit-chip {
            display: none !important;
        }

        .btn-text-pencil {
            display: inline-flex !important;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            margin-inline-start: 6px;
            border-radius: 999px;
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: white;
            font-size: 0.6rem;
            font-weight: 900;
            line-height: 1;
            vertical-align: middle;
            box-shadow: 0 4px 10px rgba(22,163,74,0.22);
        }

        .edit-badge {
            position: absolute;
            top: -4px;
            left: 28px;
            min-width: 16px;
            height: 16px;
            padding: 0 4px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #16a34a, #22c55e);
            border: 1px solid rgba(255,255,255,0.92);
            box-shadow: 0 4px 10px rgba(22,163,74,0.25);
            color: white;
            font-size: 0.6rem;
            font-weight: 900;
            line-height: 1;
            z-index: 3;
            pointer-events: none;
        }

        .btn-text-stack {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
            overflow: visible;
        }

        .btn-text-edit-note {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            height: 20px;
            padding: 0 7px;
            border-radius: 999px;
            background: rgba(22,163,74,0.12);
            border: 1px solid rgba(22,163,74,0.26);
            color: #15803d;
            font-size: 0.65rem;
            font-weight: 900;
            line-height: 1;
            white-space: nowrap;
        }


        #fAdmin,
        #fAll,
        #printBtn,
        #searchBtn,
        #cloudManualSaveBtn,
        #refreshBtn {
            gap: 11px;
        }

        #fAdmin .btn-icon,
        #fAll .btn-icon,
        #printBtn .btn-icon,
        #searchBtn .btn-icon,
        #cloudManualSaveBtn .btn-icon,
        #refreshBtn .btn-icon {
            margin-inline-start: 0;
            margin-inline-end: 7px;
        }

        .icon-flip-x {
            transform: scaleX(-1);
        }

        .top-controls-wrapper .filter-btn.active,
        .header .view-toggle button.active {
            color: white;
            background: linear-gradient(135deg, var(--btn-accent, #64748b), color-mix(in srgb, var(--btn-accent, #64748b) 72%, white));
            box-shadow: 0 14px 26px color-mix(in srgb, var(--btn-accent, #64748b) 28%, transparent), inset 0 0 0 1px rgba(255,255,255,0.08);
        }

        .top-controls-wrapper .filter-btn.active .btn-icon,
        .header .view-toggle button.active .btn-icon {
            background: rgba(255,255,255,0.22);
            box-shadow: none;
        }

        .top-controls-wrapper .filter-btn[data-v="z"] { --btn-accent: #2196f3; }
        .top-controls-wrapper .filter-btn[data-v="h"] { --btn-accent: #e0409a; }
        .top-controls-wrapper .filter-btn[data-v="t"] { --btn-accent: #8e44ad; }
        /* 29.09.2026 — צבעי השכבות בלוח כולו: הפס העליון, כפתורי התצוגה, היום
           הנוכחי ושורת ימי השבוע. כל החטיבה ומנהלה באפור (g), צוות בירוק (s). */
        html[data-evgrade="z"] { --evg: #2196f3; --evg2: #1565c0; --evgbg: #e3f2fd; }
        html[data-evgrade="h"] { --evg: #e0409a; --evg2: #b8246f; --evgbg: #fde7f2; }
        html[data-evgrade="t"] { --evg: #8e44ad; --evg2: #6a2c85; --evgbg: #f3e8f8; }
        html[data-evgrade="g"] { --evg: #64748b; --evg2: #475569; --evgbg: #eef1f4; }
        html[data-evgrade="s"] { --evg: #2f9e6e; --evg2: #00623f; --evgbg: #e7f4ed; }
        html[data-evgrade="z"] #calendarView .header,
        html[data-evgrade="h"] #calendarView .header,
        html[data-evgrade="g"] #calendarView .header,
        html[data-evgrade="s"] #calendarView .header,
        html[data-evgrade="t"] #calendarView .header { background: linear-gradient(135deg, var(--evg2) 0%, var(--evg) 100%);
          /* 29.09.2026 — קצת יותר שקוף, לבקשת נעמה */
          background: linear-gradient(135deg, color-mix(in srgb, var(--evg2) 70%, #ffffff) 0%, color-mix(in srgb, var(--evg) 58%, #ffffff) 100%); }
        html[data-evgrade="z"] #btn-grid, html[data-evgrade="h"] #btn-grid, html[data-evgrade="t"] #btn-grid,
        html[data-evgrade="z"] #btn-list, html[data-evgrade="h"] #btn-list, html[data-evgrade="t"] #btn-list,
        html[data-evgrade="z"] #btn-day, html[data-evgrade="h"] #btn-day, html[data-evgrade="t"] #btn-day,
        html[data-evgrade="g"] #btn-grid, html[data-evgrade="s"] #btn-grid, html[data-evgrade="g"] #btn-list, html[data-evgrade="s"] #btn-list,
        html[data-evgrade="g"] #btn-day, html[data-evgrade="s"] #btn-day { --btn-accent: var(--evg); }
        html[data-evgrade="z"] #calendarView .day-name,
        html[data-evgrade="h"] #calendarView .day-name,
        html[data-evgrade="g"] #calendarView .day-name,
        html[data-evgrade="s"] #calendarView .day-name,
        html[data-evgrade="t"] #calendarView .day-name { background: var(--evgbg); color: var(--evg2); }
        html[data-evgrade="z"] #calendarView .day.today,
        html[data-evgrade="h"] #calendarView .day.today,
        html[data-evgrade="g"] #calendarView .day.today,
        html[data-evgrade="s"] #calendarView .day.today,
        html[data-evgrade="t"] #calendarView .day.today { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--evg) 65%, #ffffff), 0 8px 18px rgba(0,0,0,.06); }
        html[data-evgrade="z"] #calendarView .day.today .date-num,
        html[data-evgrade="h"] #calendarView .day.today .date-num,
        html[data-evgrade="g"] #calendarView .day.today .date-num,
        html[data-evgrade="s"] #calendarView .day.today .date-num,
        html[data-evgrade="t"] #calendarView .day.today .date-num { color: var(--evg2); }
        html[data-evgrade="z"] #calendarView .today-number-badge,
        html[data-evgrade="h"] #calendarView .today-number-badge,
        html[data-evgrade="g"] #calendarView .today-number-badge,
        html[data-evgrade="s"] #calendarView .today-number-badge,
        html[data-evgrade="t"] #calendarView .today-number-badge { background: color-mix(in srgb, var(--evg) 78%, #ffffff); }
        .top-controls-wrapper .filter-btn[data-v="team"] { --btn-accent: #0f8a46; }
        .top-controls-wrapper .filter-btn[data-v="all"] { --btn-accent: #64748b; }
        #homeBtn { --btn-accent: #5b6675; }
        #refreshBtn { --btn-accent: #3b82f6; }
        #syncCheckBtn { --btn-accent: #0f8a46; }
        #printBtn { --btn-accent: #8b5cf6; }
        #searchBtn { --btn-accent: #0f766e; }
        #cloudManualSaveBtn { --btn-accent: #0f8a46; }
        #sysAdminMenuWrap { display: none; }

        .admin-home-stack {
            display: inline-flex;
            flex-direction: row;
            gap: 4px;
            align-items: center;
            width: max-content;
        }
        #homeBtn,
        #searchBtn,
        #cloudManualSaveBtn,
        #undoBtn,
        #sysAdminBtn,
        #printBtn {
            width: 38px;
            height: 38px;
            min-height: 38px;
            padding: 0;
            border-radius: 10px;
            justify-content: center;
            box-sizing: border-box;
        }
        #homeBtn .btn-text,
        #searchBtn .btn-text,
        #cloudManualSaveBtn .btn-text,
        #undoBtn .btn-text,
        #sysAdminBtn .btn-text {
            display: none;
        }
        #homeBtn .btn-icon,
        #searchBtn .btn-icon,
        #undoBtn .btn-icon,
        #sysAdminBtn .btn-icon {
            font-size: 1.05rem;
            width: auto;
            height: auto;
            border-radius: 0;
            background: none;
        }
        #btn-grid { --btn-accent: #2563eb; }
        #btn-list { --btn-accent: #7c3aed; }
        #btn-day { --btn-accent: #0f766e; }
        #prevMonthBtn, #nextMonthBtn { --btn-accent: #475569; }

        #btn-grid,
        #btn-list,
        #btn-day {
            padding: 4px 8px !important;
            min-height: 30px !important;
            border-radius: 12px !important;
            font-size: 0.7rem !important;
            gap: 4px !important;
        }

        #btn-grid .btn-icon,
        #btn-list .btn-icon,
        #btn-day .btn-icon {
            width: 17px;
            height: 17px;
            border-radius: 6px;
            font-size: 0.55rem;
            line-height: 1;
        }

        #btn-grid .btn-text,
        #btn-list .btn-text,
        #btn-day .btn-text {
            font-size: 0.7rem;
        }

        .header {
            background: linear-gradient(135deg, #334155 0%, #425d75 100%);
            color: white;
            padding: 8px 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 6px;
        }
        .nav-btn { background: white; border: none; color: var(--primary); padding: 5px 12px; border-radius: 4px; cursor: pointer; font-family: inherit; font-weight: bold; font-size: 0.9rem; }

        .view-toggle { display: inline-flex; gap: 7px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }


        .grade-class-filter-bar {
            display: none;
            align-items: center;
            justify-content: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        

        

        

        .grade-class-filter-label {
            font-size: 0.85rem;
            font-weight: 900;
            color: #475569;
        }

        .grade-class-filter-select {
            min-width: 146px;
            padding: 6px 9px;
            border-radius: 14px;
            border: 1px solid #cbd5e1;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            color: #1f2937;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 800;
            box-shadow: 0 6px 14px rgba(15,23,42,0.06);
            text-align: center;
            text-align-last: center;
        }

        .grade-class-quick-print-btn {
            width: 40px;
            height: 40px;
            border: 1px solid #cbd5e1;
            border-radius: 14px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            color: #334155;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 6px 14px rgba(15,23,42,0.06);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
            padding: 0;
            flex: 0 0 40px;
        }

        .grade-class-quick-print-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 10px 18px rgba(15,23,42,0.1);
            background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
        }

        .grade-class-quick-print-btn:active {
            transform: translateY(0);
        }

        .grade-class-quick-print-btn svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .toolbar-print-icon-btn {
            width: 40px;
            min-width: 40px;
            height: 40px;
            min-height: 40px !important;
            padding: 0 !important;
            border-radius: 14px !important;
            gap: 0 !important;
            justify-content: center !important;
            flex: 0 0 40px;
        }

        .toolbar-print-icon-btn .toolbar-print-icon-inner {
            width: 38px;
            height: 38px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: currentColor;
        }

        .toolbar-print-icon-btn svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .toolbar-print-icon-btn .btn-icon,
        .toolbar-print-icon-btn .btn-text {
            display: none !important;
        }
        .mobile-inline-print-slot {
            display: none;
        }

        .view-toggle button { padding: 4px 12px; border-radius: 14px; border: 1px solid white; background: transparent; color: white; cursor: pointer; font-family: inherit; font-size: 0.85rem; transition: 0.2s; }
        .view-toggle button.active { background: white; color: var(--primary); font-weight: bold; }

        .grid-wrapper { padding: 8px; background: #f8faf9; }
        .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: white; border: 1px solid #cbd5cf; border-radius: 8px; overflow: hidden; }
        .day-name { background: #eef1f4; padding: 8px; text-align: center; font-weight: 900; border: 1px solid #cbd5cf; color: #333; font-size: 0.9rem; }
        
        .day { min-height: 110px; border: 1px solid #ddd; padding: 5px; position: relative; cursor: pointer; transition: background 0.2s; }
        .mobile-hide-saturday { display: none !important; }
        .day:hover { background: #ffffff; }
        .day.drag-over { background: #e3f2fd !important; border: 2px dashed #2196f3; }
        
        .day.weekend-holiday { background: #eef1f4; }
        .day.weekend-holiday:hover { background: #e2e8f0; }

        
        .date-num { font-weight: 900; margin-bottom: 3px; display: flex; flex-direction: row; align-items: baseline; gap: 6px; color: var(--primary); font-size: 1rem; flex-wrap: nowrap; }

.day.today {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.72), 0 8px 18px rgba(37, 99, 235, 0.12);
    background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
}
.day.today .date-num {
    color: #1d4ed8;
}
.today-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8em;
    height: 1.8em;
    padding: 0 0.45em;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
    vertical-align: middle;
}
.calendar-grid.list-view .today-number-badge,
.calendar-grid.day-view .today-number-badge {
    min-width: 2em;
    height: 2em;
    padding: 0 0.55em;
}
        .hebrew-date-desktop { display: none !important; }
        .month-title-main { display: block; }
        .month-title-hebrew { display: none !important; }
        
        .list-only-text { display: none; }
        .grid-only-text { display: inline; }

        .event { 
            font-size: 0.75rem; padding: 3px 5px; margin-top: 2px; border-radius: 4px; border-right: 4px solid;
            background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.1); text-align: right; line-height: 1.2; 
            word-wrap: break-word; cursor: grab; font-weight: 600;
        }
        .event-time { font-weight: bold; color: #555; margin-left: 3px; font-size: 0.7rem; border-left: 1px solid #ddd; padding-left: 3px; }

        /* --- מנגנון תצוגת אירועים לנייד --- */
        #mobileEventsPanel { display: none; background: white; border: 1px solid #ddd; border-radius: 8px; margin-top: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); max-height: 55vh; flex-direction: column; overflow: hidden; }
        #mobileEventsPanel.open { display: flex !important; }
        #mobileEventsTitleBar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #eef1f4; flex-shrink: 0; background: white; }
        #mobileEventsTitle { font-weight: bold; color: var(--primary); flex: 1; font-size: 0.95rem; }
        #mobileEventsCloseBtn { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #6b7280; padding: 0 4px; }
        #mobileEventsActionsBar { padding: 8px 12px 4px; flex-shrink: 0; background: #f8faf9; border-bottom: 1px solid #eef2ff; }
        #mobileEventsContent { overflow-y: scroll; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; padding: 8px 12px; }

        /* --- תצוגת רשימה --- */
        .calendar-grid.list-view { display: flex; flex-direction: column; gap: 12px; background: transparent; border: none; }
        .calendar-grid.list-view .day-name { display: none; }
        .calendar-grid.list-view .empty-day { display: none; }
        .calendar-grid.list-view .day.no-events { display: none; }
        .calendar-grid.list-view .day { 
            min-height: auto; border: 1px solid #ddd; border-radius: 12px; background: white; 
            padding: 15px 20px; box-shadow: 0 3px 8px rgba(0,0,0,0.05); 
        }
        .calendar-grid.list-view .day.weekend-holiday { background: #eef1f4; }
        .calendar-grid.list-view .day.weekend-holiday:hover { background: #e2e8f0; }
        .calendar-grid.list-view .list-only-text { display: inline; }
        .calendar-grid.list-view .grid-only-text { display: none; }
        .calendar-grid.list-view .date-num { border-bottom: 2px solid var(--primary); padding-bottom: 8px; margin-bottom: 12px; font-size: 1.3rem; }
        .calendar-grid.list-view .hebrew-date-desktop { display: none !important; }
        .calendar-grid.list-view .event { font-size: 1.05rem; padding: 8px 12px; border-right-width: 6px; margin-bottom: 8px; display: flex; align-items: center; }
        .calendar-grid.list-view .event-time { font-size: 0.9rem; margin-left: 10px; padding-left: 10px; border-left: 2px solid #eef1f4; }

        /* --- תצוגה יומית --- */
        .calendar-grid.day-view { display: block; background: transparent; border: none; }
        .calendar-grid.day-view .day-name,
        .calendar-grid.day-view .empty-day { display: none; }
        .calendar-grid.day-view .day {
            min-height: 320px;
            border: 1px solid #d9e2ec;
            border-radius: 16px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            padding: 20px;
            box-shadow: 0 10px 24px rgba(15,23,42,0.08);
        }
        .calendar-grid.day-view .day.weekend-holiday { background: #eef1f4; }
        .calendar-grid.day-view .day.weekend-holiday:hover { background: #e2e8f0; }
        .calendar-grid.day-view .date-num {
            border-bottom: 2px solid var(--primary);
            padding-bottom: 10px;
            margin-bottom: 16px;
            font-size: 1.45rem;
        }
        .calendar-grid.day-view .list-only-text { display: inline; }
        .calendar-grid.day-view .grid-only-text { display: none; }
        .calendar-grid.day-view .event {
            font-size: 1rem;
            padding: 10px 12px;
            border-right-width: 6px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
        }
        .calendar-grid.day-view .event-time {
            font-size: 0.9rem;
            margin-left: 10px;
            padding-left: 10px;
            border-left: 2px solid #eef1f4;
        }
        .day-view-empty {
            padding: 24px 16px;
            border-radius: 14px;
            background: #f8faf9;
            border: 1px dashed #cbd5e1;
            color: #64748b;
            text-align: center;
            font-weight: 800;
        }

        .choice-chip-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }
        .choice-chip {
            border: 1px solid #cbd5e1;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            color: #334155;
            border-radius: 999px;
            padding: 8px 12px;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 800;
            transition: 0.2s ease;
            box-shadow: 0 4px 10px rgba(15,23,42,0.04);
        }
        .choice-chip:hover {
            transform: translateY(-1px);
            box-shadow: 0 8px 14px rgba(15,23,42,0.08);
        }
        .choice-chip.active {
            color: white;
            border-color: transparent;
            box-shadow: 0 10px 16px rgba(15,23,42,0.14);
        }
        .choice-chip.target-chip[data-type="z"].active { background: #2196f3; }
        .choice-chip.target-chip[data-type="h"].active { background: #e0409a; }
        .choice-chip.target-chip[data-type="t"].active { background: #8e44ad; }
        .choice-chip.target-chip[data-type="general"].active { background: #7f8c8d; }
        .choice-chip.target-chip[data-type="teachers"].active { background: #2e7d32; }
        .choice-chip.target-chip[data-type="admin"].active { background: #475569; }
        .choice-chip.target-chip[data-type="off"].active { background: #e67e22; }
        .editor-hidden-select {
            position: absolute !important;
            width: 1px !important;
            height: 1px !important;
            padding: 0 !important;
            margin: -1px !important;
            overflow: hidden !important;
            clip: rect(0, 0, 0, 0) !important;
            border: 0 !important;
        }
        .editor-class-note {
            margin-top: 8px;
            color: #64748b;
            font-size: 0.8rem;
            line-height: 1.45;
            font-weight: 700;
        }
        .class-chip.active {
            background: linear-gradient(135deg, #0f8a46, #54b26d);
        }
        .multi-grade-class-grid {
            display: grid;
            gap: 10px;
        }
        .multi-grade-class-block {
            padding: 10px;
            border-radius: 12px;
            background: rgba(255,255,255,0.88);
            border: 1px solid rgba(148,163,184,0.22);
        }
        .multi-grade-class-block[style*="display:none"] { display: none !important; }
        .multi-grade-class-title {
            font-size: 0.8rem;
            font-weight: 900;
            color: #166534;
            margin-bottom: 6px;
        }
        .multi-grade-class-block .choice-chip-grid {
            margin-top: 0;
        }
        .multi-grade-class-block.inactive-grade-block {
            opacity: 0.45;
            filter: grayscale(0.08);
        }
        .multi-grade-class-block.inactive-grade-block .multi-grade-class-title::after {
            content: ' — בחרו קודם את השכבה למעלה';
            color: #64748b;
            font-weight: 700;
            font-size: 0.75rem;
        }
        .multi-grade-class-block .class-chip:disabled {
            cursor: not-allowed;
            opacity: 0.55;
            box-shadow: none;
            transform: none;
        }

        .color-options { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
        .color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
        .color-dot.active { border-color: #000; box-shadow: 0 0 5px rgba(0,0,0,0.3);}

        .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9000; justify-content: center; align-items: center; }
        #tickerManagerModal { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; box-sizing: border-box; }
        .modal { background: white; padding: 20px; border-radius: 14px; width: 90%; max-width: 450px; max-height: 85vh; overflow-y: auto; }
        .modal input[type="text"], .modal input[type="time"], .modal select, .modal input[type="date"], .modal textarea { width: 100%; padding: 8px; margin: 8px 0; border: 1px solid #cbd5cf; border-radius: 8px; font-family: inherit; font-size: 1rem; box-sizing: border-box; }
        .print-helper-text { margin-top: 6px; color: #64748b; font-size: 0.9rem; line-height: 1.45; }
        .print-summary-box { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #f8faf9; border: 1px solid #e2e8f0; color: #334155; font-weight: 700; line-height: 1.5; }
        .event-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-bottom: 1px solid #eef1f4; }
        .action-icon { cursor: pointer; font-size: 1.3rem; margin-right: 8px; border: none; background: none; }
        
        .pin-checkbox { margin-top: 10px; display: flex; align-items: center; gap: 6px; font-weight: bold; cursor: pointer; }
        .pin-checkbox input { width: auto; margin: 0; transform: scale(1.2);}

        .portal-links-menu {
            position: relative;
            display: flex;
            justify-content: flex-end;
            align-items: flex-start;
        }

        .portal-links-menu[data-mode="students"] {
            display: none !important;
            --portal-accent: #2f80ed;
            --portal-accent-soft: rgba(47, 128, 237, 0.16);
            --portal-glow: rgba(47, 128, 237, 0.28);
            --portal-card-top: #ffffff;
            --portal-card-bottom: #eef2ff;
        }

        .portal-links-menu[data-mode="teachers"] {
            display: none !important;
            --portal-accent: #1f8b4c;
            --portal-accent-soft: rgba(31, 139, 76, 0.16);
            --portal-glow: rgba(31, 139, 76, 0.28);
            --portal-card-top: #ffffff;
            --portal-card-bottom: #ecfdf5;
        }

        .portal-menu-trigger {
            min-width: 146px;
            color: var(--portal-accent, #2f80ed);
            border: 1px solid rgba(255,255,255,0.72);
            background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(246,250,255,0.9));
            display: inline-flex;
            align-items: center;
            justify-content: space-between;
            gap: 7px;
            padding: 7px 11px;
            border-radius: 16px;
            box-shadow: 0 10px 22px rgba(15,23,42,0.09), 0 0 0 2px var(--portal-accent-soft, rgba(47, 128, 237, 0.16));
            backdrop-filter: blur(10px);
        }

        .portal-menu-trigger:hover {
            transform: translateY(-1px);
            box-shadow: 0 16px 32px rgba(15,23,42,0.12), 0 0 0 4px var(--portal-accent-soft, rgba(47, 128, 237, 0.16));
        }

        .portal-menu-trigger-label {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            line-height: 1.05;
            text-align: right;
        }

        .portal-menu-trigger-title {
            font-size: 0.8rem;
            font-weight: 900;
        }

        .portal-menu-trigger-subtitle {
            display: none;
            font-size: 0.55rem;
            font-weight: 700;
            opacity: 0.72;
            margin-top: 2px;
        }

        .portal-menu-trigger-icon {
            width: 26px;
            height: 26px;
            border-radius: 8px;
            background: linear-gradient(135deg, var(--portal-accent, #2f80ed), color-mix(in srgb, var(--portal-accent, #2f80ed) 72%, white));
            color: white;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.85rem;
            box-shadow: 0 8px 15px var(--portal-glow, rgba(47, 128, 237, 0.28));
            flex-shrink: 0;
        }

        .portal-menu-trigger-caret {
            font-size: 0.75rem;
            opacity: 0.8;
        }

        .portal-menu-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 12px);
            left: 0;
            right: auto;
            min-width: 320px;
            width: 340px;
            max-width: min(380px, calc(100vw - 24px));
            max-height: min(82vh, 560px);
            overflow-y: auto;
            background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(248,251,255,0.97));
            border: 1px solid rgba(226,232,240,0.95);
            border-radius: 24px;
            box-shadow: 0 24px 40px rgba(15,23,42,0.16);
            padding: 8px;
            z-index: 50;
            backdrop-filter: blur(16px);
            box-sizing: border-box;
        }

        .portal-menu-dropdown::-webkit-scrollbar {
            width: 8px;
        }

        .portal-menu-dropdown::-webkit-scrollbar-thumb {
            background: rgba(148,163,184,0.55);
            border-radius: 999px;
        }

        .portal-menu-dropdown.show {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .portal-menu-item {
            width: 100%;
            border: 1px solid rgba(203,213,225,0.7);
            border-radius: 16px;
            padding: 7px 9px;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 900;
            cursor: pointer;
            background: linear-gradient(180deg, var(--portal-card-top, #ffffff), var(--portal-card-bottom, #eef2ff));
            color: #0f172a;
            text-align: right;
            transition: 0.22s;
            display: flex;
            align-items: center;
            gap: 9px;
            box-sizing: border-box;
        }

        .portal-menu-item:hover {
            transform: translateY(-1px);
            border-color: var(--portal-accent, #2f80ed);
            box-shadow: 0 14px 26px rgba(15,23,42,0.09);
        }

        .portal-menu-item-icon {
            width: 32px;
            height: 32px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, var(--portal-accent, #2f80ed), color-mix(in srgb, var(--portal-accent, #2f80ed) 70%, white));
            color: white;
            font-size: 0.9rem;
            box-shadow: 0 8px 15px var(--portal-glow, rgba(47, 128, 237, 0.28));
            flex-shrink: 0;
        }

        .portal-menu-item-text {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            flex: 1;
            min-width: 0;
            line-height: 1.08;
        }

        .portal-menu-item-title {
            font-size: 0.9rem;
            font-weight: 900;
            color: var(--portal-accent, #2f80ed);
            white-space: normal;
            line-height: 1.18;
        }

        .portal-menu-item-subtitle {
            font-size: 0.65rem;
            font-weight: 700;
            color: #64748b;
            margin-top: 3px;
        }

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        #audHomeBtn,
        #audBackBtn {
            width: 100%;
            box-sizing: border-box;
            justify-content: flex-start;
        }

        #audHomeBtn .btn-icon,
        #audBackBtn .btn-icon {
            flex: 0 0 22px;
        }

        #audHomeBtn .btn-text,
        #audBackBtn .btn-text {
            text-align: right;
        }

        

        
        

        

        

        #evMoreText {
            min-height: 58px;
            resize: none;
            line-height: 1.4;
        }

        .event-details-card {
            width: min(430px, calc(100vw - 24px));
            border-radius: 20px;
            padding: 20px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border: 1px solid rgba(226,232,240,0.95);
            box-shadow: 0 26px 48px rgba(15,23,42,0.22);
        }

        .event-details-title {
            margin: 0;
            font-size: 1.2rem;
            font-weight: 900;
            color: #223041;
            line-height: 1.35;
        }

        .event-details-subtitle {
            margin-top: 4px;
            color: #64748b;
            font-size: 0.9rem;
            line-height: 1.45;
        }

        .event-details-list {
            display: grid;
            gap: 8px;
            margin-top: 14px;
        }

        .event-details-row {
            padding: 9px 11px;
            border-radius: 12px;
            background: #f8faf9;
            border: 1px solid #e2e8f0;
        }

        .event-details-label {
            font-size: 0.75rem;
            font-weight: 900;
            color: #64748b;
            margin-bottom: 3px;
        }

        .event-details-value {
            color: #0f172a;
            font-size: 0.95rem;
            font-weight: 700;
            white-space: pre-wrap;
            line-height: 1.5;
        }

        .event-details-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            margin-top: 16px;
            flex-wrap: wrap;
        }
        .event-icon-btn {
            width: 40px !important;
            min-width: 40px !important;
            height: 40px !important;
            padding: 0 !important;
            font-size: 18px !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            border-radius: 10px !important;
            position: relative !important;
        }
        [data-tooltip] { position: relative; }
        [data-tooltip]::after {
            content: attr(data-tooltip);
            position: absolute;
            top: calc(100% + 7px);
            left: 50%;
            transform: translateX(-50%);
            background: rgba(15,30,60,0.88);
            color: #fff;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 500;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.15s ease;
            z-index: 9999;
            direction: rtl;
            box-shadow: 0 2px 8px rgba(0,0,0,0.18);
        }
        [data-tooltip]::before {
            content: '';
            position: absolute;
            top: calc(100% + 2px);
            left: 50%;
            transform: translateX(-50%);
            border: 5px solid transparent;
            border-bottom-color: rgba(15,30,60,0.88);
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.15s ease;
            z-index: 9999;
        }
        [data-tooltip]:hover::after,
        [data-tooltip]:hover::before {
            opacity: 1;
        }

        .event-details-chip-row {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 2px;
        }

        .event-details-chip {
            display: inline-flex;
            align-items: center;
            padding: 4px 8px;
            border-radius: 999px;
            background: rgba(59,130,246,0.08);
            border: 1px solid rgba(59,130,246,0.15);
            color: #334155;
            font-size: 0.8rem;
            font-weight: 800;
            line-height: 1.2;
        }

        /* התאמות לנייד */
        @media (max-width: 768px) {
            body { padding: 6px; }
            .container { border-radius: 14px; min-height: auto; }
            #mainMenuView { padding: 22px 14px 14px; }

            .welcome-text {
                display: flex;
                direction: rtl;
                flex-direction: row;
                align-items: center;
                justify-content: center;
                gap: 12px;
                color: var(--grey-text);
                font-size: 1.6rem;
                margin-bottom: 18px;
                text-align: center;
            }

            .welcome-inline-icon {
                display: none;
            }

            .portal-title { font-size: 2rem !important; margin-top: 12px; margin-bottom: 0; line-height: 1.15; }
            .title-logo-header { width: 40px; height: 40px; top: -1px; margin-right: 4px; }

            .menu-grid {
                grid-template-columns: 1fr;
                gap: 10px;
                align-items: stretch;
            }

            .students-card,
            .teachers-card {
                grid-column: 1 / -1 !important;
                grid-row: auto !important;
            }

            .menu-card {
                min-height: 0;
                height: auto;
                width: min(100%, 274px);
                aspect-ratio: auto;
                margin: 0 auto;
                padding: 16px 12px;
                border-radius: 20px;
            }

            .menu-card-content {
                gap: 7px;
                justify-content: flex-start;
            }
            .menu-card-title { font-size: 1.15rem; }
            .portal-lock-inline { width: 20px; height: 20px; font-size: 0.85rem; padding: 0; }
            .menu-card-subtitle { font-size: 0.7rem; line-height: 1.38; gap: 4px; margin-top: 8px; }
            .menu-card-topline { font-size: inherit; }
            .menu-card-highlight { font-size: 1.28em; }
            .menu-card-subtitle-line { gap: 2px 4px; }
            
            .menu-card-dot { margin: 0 1px; }
            .menu-card-dot img { width: 10px; height: 10px; }

            .center-logo {
                display: none !important;
            }

            .mobile-bottom-icon {
                display: flex !important;
                justify-content: center;
                align-items: center;
                margin: 12px auto 10px;
            }

            .mobile-bottom-icon .app-icon {
                width: 96px;
                height: 96px;
            }

            .home-quote {
                font-size: 1.1rem;
                max-width: 280px;
                margin-top: 10px;
            }

            .site-credit {
                margin: 18px auto 0;
                font-size: 0.9rem;
                max-width: 320px;
                line-height: 1.45;
                padding: 0 8px;
            }


            .site-credit-location {
                margin: 2px auto 0;
                font-size: 0.7rem;
                max-width: 320px;
                line-height: 1.3;
                padding: 0 8px;
            }

            .top-controls-wrapper { padding: 8px 8px 10px; }

            .admin-actions {
                display: flex;
                flex-direction: row;
                justify-content: space-between;
                align-items: flex-start;
                gap: 8px;
                flex-wrap: nowrap;
            }

            .portal-links-menu { width: auto; flex: 0 0 auto; justify-content: flex-start; max-width: calc(100vw - 110px); }
            .admin-home-stack { gap: 3px; flex-direction: row; align-items: center; }
            .portal-menu-trigger { min-width: 0; width: auto; max-width: 100%; padding: 8px 10px; }
            .portal-menu-trigger-label { min-width: 0; }
            .portal-menu-trigger-title { font-size: 0.8rem; }
            .portal-menu-trigger-subtitle { display: none; }
            .portal-menu-dropdown {
                left: 0;
                right: auto;
                top: calc(100% + 10px);
                min-width: 0;
                width: min(350px, calc(100vw - 16px));
                max-width: min(350px, calc(100vw - 16px));
                max-height: min(72vh, 520px);
                border-radius: 20px;
            }
            .portal-menu-item { padding: 9px 10px; gap: 9px; }
            .portal-menu-item-icon { width: 32px; height: 32px; font-size: 0.85rem; }
            .portal-menu-item-title { font-size: 0.85rem; }
            .portal-menu-item-subtitle { font-size: 0.6rem; }

            
            
            
            

            #studentPortalTitle,
            #teacherPortalTitle {
                font-size: 1.45rem !important;
                margin-bottom: 10px !important;
                line-height: 1.2;
            }

            .main-filters { gap: 6px; margin-top: 6px; }
            .grade-class-filter-bar {
                margin-top: 3px;
                gap: 0;
            }
            .grade-class-filter-label {
                display: none;
            }
            .grade-class-filter-select {
                min-width: 0;
                width: 96px;
                max-width: 96px;
                font-size: 0.65rem;
                padding: 2px 6px;
                min-height: 28px;
                border-radius: 10px;
                text-align: center;
            }
            .grade-class-quick-print-btn {
                width: 30px;
                height: 30px;
                border-radius: 10px;
                flex: 0 0 30px;
            }
            .grade-class-quick-print-btn svg {
                width: 14px;
                height: 14px;
            }
            .toolbar-print-icon-btn {
                width: 30px;
                min-width: 30px;
                height: 30px;
                min-height: 30px !important;
                border-radius: 10px !important;
                flex: 0 0 30px;
            }
            .toolbar-print-icon-btn .toolbar-print-icon-inner {
                width: 30px;
                height: 30px;
                border-radius: 10px;
            }
            .toolbar-print-icon-btn svg {
                width: 14px;
                height: 14px;
            }
            #calendarView.teachers-mode .main-filters {
                display: grid;
                grid-template-columns: repeat(6, minmax(0, 1fr));
                column-gap: 4px;
                row-gap: 5px;
                justify-content: center;
                align-items: stretch;
                width: min(100%, 340px);
                margin-inline: auto;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                max-width: none;
                min-width: 0;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"] {
                width: 100%;
                min-width: 0;
                justify-self: stretch;
            }
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll,
            #calendarView.teachers-mode #printBtn {
                width: 100%;
                min-width: 0;
                justify-self: stretch;
            }
            #calendarView.teachers-mode #fGen {
                grid-column: 1 / 3;
                grid-row: 1;
            }
            #calendarView.teachers-mode #fAll {
                grid-column: 3 / 5;
                grid-row: 1;
            }
            #calendarView.teachers-mode #printBtn {
                grid-column: 5 / 7;
                grid-row: 1;
                display: inline-flex;
                justify-content: center;
                align-items: center;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"] {
                grid-column: 1 / 3;
                grid-row: 2;
            }
            #calendarView.teachers-mode .main-filters > [data-v="h"] {
                grid-column: 3 / 5;
                grid-row: 2;
            }
            #calendarView.teachers-mode .main-filters > [data-v="t"] {
                grid-column: 5 / 7;
                grid-row: 2;
            }
            #calendarView.teachers-mode .grade-class-filter-bar {
                margin-top: 6px;
                justify-content: center;
            }
            .top-controls-wrapper .filter-btn,
            .header .nav-btn,
            .header .view-toggle button {
                min-height: 34px;
                padding: 6px 8px;
                font-size: 0.75rem;
                border-radius: 14px;
            }
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                padding: 6px 7px;
                font-size: 0.7rem;
                min-height: 32px;
            }
            #calendarView.teachers-mode #fGen .btn-icon,
            #calendarView.teachers-mode #fAdmin .btn-icon,
            #calendarView.teachers-mode #fAll .btn-icon {
                width: 18px;
                height: 18px;
                font-size: 0.6rem;
                border-radius: 6px;
            }
            #calendarView.teachers-mode #fGen .btn-text,
            #calendarView.teachers-mode #fAdmin .btn-text,
            #calendarView.teachers-mode #fAll .btn-text {
                font-size: 0.7rem;
            }

            .btn-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 0.65rem; }

            .btn-edit-chip {
                width: 15px;
                height: 15px;
                margin-inline-start: 2px;
                font-size: 0.55rem;
                flex-basis: 15px;
            }
            .btn-text-pencil {
                display: inline-flex !important;
                width: 14px;
                height: 14px;
                margin-inline-start: 4px;
                font-size: 0.5rem;
            }

            .edit-badge {
                top: -3px;
                left: 24px;
                min-width: 14px;
                height: 14px;
                padding: 0 3px;
                font-size: 0.5rem;
            }

            .btn-text-stack {
                gap: 4px;
            }

            .btn-text-edit-note {
                height: 17px;
                padding: 0 5px;
                font-size: 0.55rem;
            }


            .edit-only-pill {
                min-width: 20px;
                height: 20px;
                padding: 0 6px;
                font-size: 0.65rem;
            }

            #fAll,
            #printBtn,
            #searchBtn,
            #refreshBtn { gap: 8px; }

            #fAll .btn-icon,
            #printBtn .btn-icon,
            #searchBtn .btn-icon,
            #refreshBtn .btn-icon { margin-inline-end: 4px; }

            .header {
                display: grid;
                grid-template-columns: 1fr 1fr;
                grid-template-areas:
                    "title title"
                    "prev next";
                align-items: center;
                gap: 8px;
                padding: 10px 8px 12px;
            }

            .header > div { grid-area: title; width: 100%; }
            #prevMonthBtn { grid-area: prev; width: auto; justify-self: start; }
            #nextMonthBtn { grid-area: next; width: auto; justify-self: end; }
            .header .nav-btn { width: auto; justify-content: center; }
            #prevMonthBtn,
            #nextMonthBtn {
                padding: 4px 8px !important;
                min-height: 28px !important;
                border-radius: 12px !important;
                font-size: 0.7rem !important;
                gap: 4px !important;
            }
            #prevMonthBtn .btn-icon,
            #nextMonthBtn .btn-icon {
                width: 17px;
                height: 17px;
                border-radius: 6px;
                font-size: 0.55rem;
                line-height: 1;
            }
            #prevMonthBtn .btn-text,
            #nextMonthBtn .btn-text {
                font-size: 0.7rem;
            }
            #mTitle { font-size: 1.2rem; }
            .view-toggle { margin-top: 6px; gap: 6px; }

            #btn-grid,
            #btn-list,
            #btn-day {
                padding: 4px 7px !important;
                min-height: 30px !important;
                font-size: 0.7rem !important;
            }

            .grid-wrapper { padding: 6px; }
            .calendar-grid:not(.list-view) {
                display: grid;
                grid-template-columns: repeat(6, minmax(0, 1fr));
                gap: 0;
                background: #ffffff;
                border: 1px solid #cbd5e1;
                border-radius: 10px;
                overflow: hidden;
                align-items: stretch;
                box-shadow: 0 3px 10px rgba(15,23,42,0.05);
            }
            .calendar-grid:not(.list-view) .day,
            .calendar-grid:not(.list-view) .day-name {
                box-sizing: border-box;
                width: 100%;
                min-width: 0;
            }
            .calendar-grid:not(.list-view) .day {
                min-height: 96px;
                height: auto;
                padding: 4px 3px 5px;
                border-left: 1px solid #e2e8f0;
                border-top: 1px solid #e2e8f0;
                border-right: none;
                border-bottom: none;
                border-radius: 0;
                display: flex;
                flex-direction: column;
                align-items: stretch;
                justify-content: flex-start;
                background: #ffffff;
                overflow: hidden;
            }
            .calendar-grid:not(.list-view) .day-name {
                font-size: 0.7rem;
                padding: 6px 0;
                border-left: 1px solid #e2e8f0;
                border-top: none;
                border-right: none;
                border-bottom: 1px solid #e2e8f0;
                background: #f8faf9;
                text-align: center;
                font-weight: 900;
                color: #334155;
            }
            .calendar-grid:not(.list-view) > :nth-child(6n) {
                border-left: none !important;
            }
            .calendar-grid:not(.list-view) .day.empty-day {
                background: #f8faf9;
            }
            .calendar-grid:not(.list-view) .date-num {
                font-size: 0.85rem;
                margin-bottom: 3px;
                text-align: center;
                justify-content: center;
            }
            .calendar-grid:not(.list-view) .today-number-badge { min-width: 1.6em; height: 1.6em; padding: 0 0.35em; font-size: 0.95em; }
            .hebrew-date-desktop,
            .month-title-hebrew { display: none !important; }
            .calendar-grid:not(.list-view) .event {
                display: block !important;
                font-size: 0.55rem;
                padding: 3px 4px;
                margin-top: 2px;
                border-right-width: 3px;
                white-space: normal;
                word-wrap: break-word;
                overflow-wrap: anywhere;
                line-height: 1.2;
                border-radius: 4px;
                box-shadow: none;
            }
            .calendar-grid:not(.list-view) .event-time { display: none; }
            .calendar-grid:not(.list-view) .day-name.mobile-hide-saturday,
            .calendar-grid:not(.list-view) .day.mobile-hide-saturday { display: none !important; }

            .calendar-grid.list-view { gap: 10px; }
            .calendar-grid.list-view .day { padding: 12px 14px; }
            .calendar-grid.list-view .day.weekend-holiday { background: #eef1f4; }
            .calendar-grid.list-view .date-num { font-size: 1.1rem; padding-bottom: 6px; margin-bottom: 8px; }
            .calendar-grid.list-view .event { font-size: 0.9rem; padding: 7px 9px; align-items: flex-start; }
            .calendar-grid.list-view .event-time { font-size: 0.75rem; margin-left: 8px; padding-left: 8px; }

            .modal {
                width: calc(100vw - 20px);
                max-width: none;
                padding: 16px 14px;
                border-radius: 14px;
                max-height: 96vh;
            }

            .event-details-card {
                width: calc(100vw - 20px);
                padding: 16px 14px;
                border-radius: 16px;
            }
            .event-details-title {
                font-size: 1rem;
            }
            .event-details-subtitle {
                font-size: 0.8rem;
            }
            .event-details-row {
                padding: 8px 10px;
            }
            .event-details-value {
                font-size: 0.85rem;
            }
        }

        @media (max-width: 480px) {
            .welcome-text { font-size: 1.45rem; gap: 10px; }
            .welcome-inline-icon { display: none; }
            .portal-title { font-size: 1.8rem !important; }
            .mobile-bottom-icon { margin: 10px auto 8px; }
            .mobile-bottom-icon .app-icon { width: 88px; height: 88px; }
            .menu-card {
                min-height: 0;
                padding: 14px 11px;
                width: min(100%, 262px);
            }
            .menu-card-title { font-size: 1.1rem; }
            .portal-lock-inline { width: 18px; height: 18px; font-size: 0.8rem; padding: 0; }
            .menu-card-subtitle { font-size: 0.65rem; line-height: 1.34; margin-top: 6px; }
            .menu-card-highlight { font-size: 1.22em; }
            .portal-menu-trigger { padding: 7px 9px; }
            .portal-menu-trigger-title { font-size: 0.75rem; }
            #studentPortalTitle,
            #teacherPortalTitle { font-size: 1.25rem !important; }
            .main-filters { gap: 5px; }
            .grade-class-filter-bar {
                margin-top: 2px;
                gap: 0;
            }
            .grade-class-filter-label {
                display: none;
            }
            .grade-class-filter-select {
                width: 92px;
                max-width: 92px;
                font-size: 0.6rem;
                padding: 2px 6px;
                min-height: 27px;
                border-radius: 10px;
                text-align: center;
            }
            #calendarView.teachers-mode .main-filters {
                display: grid;
                grid-template-columns: repeat(6, max-content);
                column-gap: 4px;
                row-gap: 4px;
                justify-content: center;
                align-items: stretch;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                max-width: none;
                min-width: 0;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"] {
                width: 100%;
                min-width: 0;
                justify-self: stretch;
            }
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll,
            #calendarView.teachers-mode #printBtn {
                width: 100%;
                min-width: 0;
                justify-self: stretch;
            }
            #calendarView.teachers-mode #fGen {
                grid-column: 1 / 3;
                grid-row: 1;
            }
            #calendarView.teachers-mode #fAll {
                grid-column: 3 / 5;
                grid-row: 1;
            }
            #calendarView.teachers-mode #printBtn {
                grid-column: 5 / 7;
                grid-row: 1;
                display: inline-flex;
                justify-content: center;
                align-items: center;
            }
            #calendarView.teachers-mode .main-filters > [data-v="z"] {
                grid-column: 1 / 3;
                grid-row: 2;
            }
            #calendarView.teachers-mode .main-filters > [data-v="h"] {
                grid-column: 3 / 5;
                grid-row: 2;
            }
            #calendarView.teachers-mode .main-filters > [data-v="t"] {
                grid-column: 5 / 7;
                grid-row: 2;
            }
            #calendarView.teachers-mode .grade-class-filter-bar {
                margin-top: 5px;
                justify-content: center;
            }
            .top-controls-wrapper .filter-btn { padding: 6px 7px; font-size: 0.7rem; }
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                padding: 5px 6px;
                font-size: 0.7rem;
                min-height: 30px;
            }
            #calendarView.teachers-mode #fGen .btn-icon,
            #calendarView.teachers-mode #fAdmin .btn-icon,
            #calendarView.teachers-mode #fAll .btn-icon {
                width: 17px;
                height: 17px;
                font-size: 0.55rem;
                border-radius: 6px;
            }
            #calendarView.teachers-mode #fGen .btn-text,
            #calendarView.teachers-mode #fAdmin .btn-text,
            #calendarView.teachers-mode #fAll .btn-text {
                font-size: 0.65rem;
            }
            .btn-edit-chip {
                width: 14px;
                height: 14px;
                margin-inline-start: 2px;
                font-size: 0.5rem;
                flex-basis: 14px;
            }
            .btn-text-pencil {
                display: inline-flex !important;
                width: 14px;
                height: 14px;
                margin-inline-start: 4px;
                font-size: 0.5rem;
            }
            .header .nav-btn { font-size: 0.7rem; }
            #prevMonthBtn,
            #nextMonthBtn {
                padding: 4px 7px !important;
                min-height: 26px !important;
                font-size: 0.65rem !important;
            }
            #prevMonthBtn .btn-icon,
            #nextMonthBtn .btn-icon {
                width: 16px;
                height: 16px;
                font-size: 0.5rem;
            }
            #prevMonthBtn .btn-text,
            #nextMonthBtn .btn-text {
                font-size: 0.65rem;
            }
            #mTitle { font-size: 1.05rem; }
            .calendar-grid:not(.list-view) .day { min-height: 90px; }
            .calendar-grid:not(.list-view) .event { font-size: 0.5rem; }
        }
    
        .event.event-clickable {
            cursor: pointer;
        }

        .event.event-clickable:hover {
            transform: translateY(-1px);
            box-shadow: 0 8px 18px rgba(15,23,42,0.12);
        }

        .day-actions-card {
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            width: min(430px, calc(100vw - 24px));
            border-radius: 24px;
            padding: 20px;
            box-shadow: 0 26px 48px rgba(15,23,42,0.22);
            border: 1px solid rgba(226,232,240,0.95);
        }

        .day-actions-header,
        .editor-panel-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }

        .day-actions-title,
        .editor-panel-title {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 900;
            color: #223041;
        }

        .day-actions-subtitle,
        .editor-panel-subtitle {
            margin-top: 4px;
            color: #64748b;
            font-size: 0.9rem;
            line-height: 1.45;
        }

        .dialog-close-btn,
        .editor-close-btn {
            border: none;
            background: #eef1f4;
            color: #475569;
            width: 36px;
            height: 36px;
            border-radius: 12px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 900;
            flex-shrink: 0;
        }

        .dialog-close-btn:hover,
        .editor-close-btn:hover {
            background: #e2e8f0;
        }

        .day-actions-summary {
            margin-top: 14px;
            background: #f8faf9;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 14px;
            color: #334155;
            line-height: 1.55;
            max-height: 180px;
            overflow: auto;
        }

        .day-actions-summary-empty {
            color: #64748b;
            font-weight: 700;
        }

        .day-actions-preview-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid rgba(226,232,240,0.8);
        }

        .day-actions-preview-item:first-child {
            margin-top: 0;
            padding-top: 0;
            border-top: none;
        }

        .day-actions-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .day-actions-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            margin-top: 16px;
        }

        .day-actions-event-list {
            display: grid;
            gap: 10px;
        }

        .day-actions-event-list-head {
            padding: 12px 14px;
            border-radius: 16px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border: 1px solid #e2e8f0;
            color: #223041;
            box-shadow: 0 10px 20px rgba(15,23,42,0.06);
        }

        .day-actions-event-list-title {
            font-size: 0.95rem;
            font-weight: 900;
            color: #223041;
        }

        .day-actions-event-list-subtitle {
            margin-top: 4px;
            color: #64748b;
            font-size: 0.75rem;
            font-weight: 700;
            line-height: 1.5;
        }

        .day-action-btn,
        .editor-mode-btn,
        .editor-card-btn,
        .editor-main-btn {
            border: none;
            cursor: pointer;
            font-family: inherit;
            font-weight: 900;
            border-radius: 16px;
            transition: 0.2s;
        }

        .day-action-btn {
            padding: 14px 16px;
            text-align: right;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border: 1px solid #e2e8f0;
            color: #223041;
            box-shadow: 0 10px 20px rgba(15,23,42,0.06);
        }

        .day-action-btn:hover,
        .editor-mode-btn:hover,
        .editor-card-btn:hover,
        .editor-main-btn:hover {
            transform: translateY(-1px);
        }

        .day-action-btn small {
            display: block;
            margin-top: 4px;
            color: #64748b;
            font-size: 0.75rem;
            font-weight: 700;
        }

        .editor-panel {
            position: relative;
        }

        .editor-mode-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin: 14px 0 10px;
        }

        .editor-mode-btn {
            padding: 9px 12px;
            background: #eef1f4;
            color: #334155;
            border: 1px solid #e2e8f0;
        }

        .editor-mode-btn.active {
            background: linear-gradient(135deg, #3b82f6, #2563eb);
            color: white;
            border-color: transparent;
            box-shadow: 0 14px 28px rgba(37,99,235,0.22);
        }

        .editor-section {
            margin-top: 14px;
        }

        .editor-section-label {
            margin: 0 0 10px;
            color: #334155;
            font-size: 0.95rem;
            font-weight: 900;
        }

        .editor-empty-state {
            padding: 18px 14px;
            border-radius: 16px;
            background: #f8faf9;
            border: 1px dashed #cbd5e1;
            color: #64748b;
            font-weight: 700;
            text-align: center;
        }

        .editor-event-card {
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 10px 12px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            box-shadow: 0 8px 16px rgba(15,23,42,0.05);
            margin-bottom: 8px;
        }

        .editor-event-card-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }

        .editor-event-card-title {
            font-weight: 900;
            line-height: 1.45;
        }

        .editor-event-card-meta {
            margin-top: 6px;
            color: #64748b;
            font-size: 0.8rem;
            font-weight: 700;
        }

        .editor-event-card-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
            flex-wrap: wrap;
        }

        .editor-card-btn {
            padding: 8px 12px;
            background: #eef2ff;
            color: #334155;
            border: 1px solid #e2e8f0;
        }

        .editor-card-btn.danger,
        .editor-main-btn.danger {
            background: #fef2f2;
            color: #be123c;
            border: 1px solid #fecdd3;
        }

        .editor-actions-row {
            display: flex;
            gap: 8px;
            margin-top: 14px;
            flex-wrap: wrap;
            position: sticky;
            bottom: -10px;
            padding-top: 10px;
            padding-bottom: 6px;
            background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.92) 18%, #ffffff 100%);
            backdrop-filter: blur(6px);
            z-index: 2;
        }

        .editor-main-btn {
            flex: 1;
            min-width: 110px;
            padding: 10px 12px;
            background: linear-gradient(135deg, #68a824, #4f8f1f);
            color: white;
            box-shadow: 0 12px 24px rgba(104,168,36,0.16);
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
        }

        .editor-main-btn.secondary {
            background: #eef1f4;
            color: #334155;
            box-shadow: none;
        }

        .editor-form-row {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .editor-form-field {
            flex: 1;
            min-width: 180px;
        }

        .editor-form-help {
            margin-top: 6px;
            color: #64748b;
            font-size: 0.75rem;
            font-weight: 700;
        }
        .editor-flags-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 8px 10px;
            margin-top: 10px;
        }

        .editor-target-row {
            margin-top: 8px;
        }

        .editor-color-label {
            margin-top: 10px !important;
        }

        .editor-target-inline {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 4px;
            flex-wrap: nowrap;
        }

        .editor-target-inline .color-options {
            margin: 0;
            gap: 4px;
            flex-wrap: nowrap;
        }

        .editor-target-inline .color-dot {
            width: 20px;
            height: 20px;
        }

        .search-modal-card {
            width: min(680px, calc(100vw - 24px));
            max-height: min(84vh, 760px);
            border-radius: 20px;
            overflow-y: auto;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            border: 1px solid rgba(226,232,240,0.95);
            box-shadow: 0 26px 48px rgba(15,23,42,0.22);
        }

        .search-modal-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
        }

        .search-modal-title {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 900;
            color: #223041;
        }

        .search-modal-subtitle {
            margin-top: 4px;
            color: #64748b;
            font-size: 0.9rem;
            line-height: 1.45;
        }

        .search-input-wrap {
            display: flex;
            gap: 10px;
            align-items: stretch;
            flex-wrap: wrap;
        }

        .search-input-wrap input {
            flex: 1;
            min-width: 220px;
            padding: 11px 13px;
            border-radius: 14px;
            border: 1px solid #cbd5e1;
            font-family: inherit;
            font-size: 0.95rem;
            box-sizing: border-box;
            background: #fff;
        }

        .search-input-wrap button {
            min-width: 120px;
        }

        .search-filter-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .search-filter-wrap label {
            color: #334155;
            font-size: 0.85rem;
            font-weight: 900;
        }

        .search-filter-wrap select {
            min-width: 190px;
            padding: 9px 12px;
            border-radius: 14px;
            border: 1px solid #cbd5e1;
            font-family: inherit;
            font-size: 0.95rem;
            font-weight: 800;
            color: #1f2937;
            background: #fff;
            box-sizing: border-box;
        }

        .search-scope-text {
            margin-top: 10px;
            color: #475569;
            font-size: 0.8rem;
            font-weight: 800;
        }

        .search-actions-row {
            display: flex;
            justify-content: flex-start;
            gap: 10px;
            margin-top: 10px;
            flex-wrap: wrap;
        }

        .search-secondary-btn {
            min-width: 160px;
            padding: 10px 14px;
            border-radius: 14px;
            border: 1px solid #cbd5e1;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            color: #223041;
            font-family: inherit;
            font-size: 0.9rem;
            font-weight: 900;
            cursor: pointer;
            box-shadow: 0 8px 16px rgba(15,23,42,0.05);
            transition: 0.2s;
        }

        .search-secondary-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 12px 20px rgba(15,23,42,0.08);
        }

        .search-secondary-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
            box-shadow: none;
        }

        .search-results {
            margin-top: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .search-result-card {
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 12px 14px;
            background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
            box-shadow: 0 8px 16px rgba(15,23,42,0.05);
        }

        .search-result-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .search-result-date {
            color: #475569;
            font-size: 0.8rem;
            font-weight: 900;
        }

        .search-result-board {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 4px 9px;
            border-radius: 999px;
            background: #eef2ff;
            color: #334155;
            font-size: 0.7rem;
            font-weight: 900;
            white-space: nowrap;
        }

        .search-result-title {
            margin-top: 8px;
            font-size: 1rem;
            font-weight: 900;
            line-height: 1.5;
        }

        .search-result-meta {
            margin-top: 6px;
            color: #64748b;
            font-size: 0.8rem;
            font-weight: 700;
            line-height: 1.5;
        }

        .search-empty-state {
            padding: 20px 14px;
            border-radius: 16px;
            background: #f8faf9;
            border: 1px dashed #cbd5e1;
            color: #64748b;
            font-weight: 700;
            text-align: center;
        
            display: none;
        
            display: none !important;
        }

        .search-focus-ring {
            animation: searchFocusPulse 1.8s ease-in-out 2;
        }

        @keyframes searchFocusPulse {
            0% { box-shadow: 0 0 0 0 rgba(15,118,110,0.28); }
            50% { box-shadow: 0 0 0 6px rgba(15,118,110,0.12); }
            100% { box-shadow: 0 0 0 0 rgba(15,118,110,0); }
        }

        @media (min-width: 769px) {
            #modal {
                justify-content: flex-end;
                align-items: stretch;
                padding: 0;
                background: rgba(15,23,42,0.34);
            }

            #modal .editor-panel {
                width: min(400px, 100vw);
                max-width: min(400px, 100vw);
                height: 90vh;
                max-height: 90vh;
                margin: 18px 0 18px 18px;
                border-radius: 20px 0 0 22px;
                padding: 14px 14px 14px;
                box-shadow: -18px 0 40px rgba(15,23,42,0.16);
                overflow-y: auto;
            }
        }

        @media (max-width: 768px) {
            #calendarView:not(.teachers-mode) #printBtn {
                display: none !important;
            }

            .day-actions-card {
                width: calc(100vw - 18px);
                border-radius: 16px;
                padding: 15px 13px;
            }

            .search-modal-card {
                width: calc(100vw - 14px);
                max-height: 92vh;
                border-radius: 16px;
                padding: 16px 14px;
            }

            .search-input-wrap {
                flex-direction: column;
            }

            .search-input-wrap button {
                width: 100%;
                min-width: 0;
            }

            #modal .editor-panel {
                width: calc(100vw - 8px);
                max-width: calc(100vw - 8px);
                max-height: 96vh;
                padding: 10px 8px 10px;
                border-radius: 16px;
                margin: 0;
            }

            .editor-panel-header {
                gap: 6px;
                margin-bottom: 2px;
            }

            .editor-panel-title {
                font-size: 1rem;
                line-height: 1.15;
            }

            .editor-panel-subtitle {
                display: none;
            }

            .editor-close-btn {
                width: 30px;
                height: 30px;
                border-radius: 8px;
                font-size: 0.85rem;
            }

            .editor-mode-bar {
                gap: 4px;
                margin: 8px 0 6px;
            }

            .editor-mode-btn {
                flex: 1 1 calc(33.333% - 3px);
                min-width: 0;
                font-size: 0.7rem;
                padding: 7px 5px;
                border-radius: 12px;
            }

            .editor-section {
                margin-top: 7px;
            }

            .editor-section-label {
                margin-bottom: 6px;
                font-size: 0.8rem;
            }

            #eventFormSection > input[type="text"],
            #eventFormSection > input[type="date"],
            #eventFormSection > input[type="time"],
            #eventFormSection > textarea,
            #eventFormSection select,
            #eventFormSection .editor-form-field input,
            #eventFormSection .editor-form-field select {
                margin: 4px 0;
                padding: 6px 8px;
                font-size: 0.9rem;
            }

            .editor-form-row {
                gap: 6px;
                margin-top: 6px;
            }

            .editor-form-field {
                min-width: 0;
            }

            #evClassWrap {
                padding: 6px 8px !important;
            }

            .multi-grade-class-grid {
                gap: 7px;
            }

            .multi-grade-class-block {
                padding: 7px 8px;
                border-radius: 10px;
            }

            .multi-grade-class-title {
                font-size: 0.75rem;
                margin-bottom: 5px;
            }

            .pin-checkbox {
                margin-top: 0;
                gap: 4px;
                font-size: 0.8rem;
                line-height: 1.15;
                min-width: 0;
            }

            .pin-checkbox input {
                transform: scale(0.95);
            }

            .color-options {
                gap: 4px;
                margin: 6px 0 4px;
            }

            .color-dot {
                width: 20px;
                height: 20px;
            }

            .editor-target-inline {
                gap: 6px;
                margin-bottom: 3px;
            }

            .editor-target-inline .color-options {
                gap: 3px;
            }

            .editor-target-inline .color-dot {
                width: 16px;
                height: 16px;
            }

            .editor-event-card {
                padding: 9px 10px;
                border-radius: 14px;
                margin-bottom: 7px;
            }

            .editor-event-card-title {
                font-size: 0.9rem;
                line-height: 1.35;
            }

            .editor-event-card-meta {
                margin-top: 4px;
                font-size: 0.75rem;
            }

            .editor-card-btn {
                padding: 7px 10px;
                font-size: 0.8rem;
            }

            .editor-actions-row {
                flex-direction: row;
                gap: 6px;
                margin-top: 8px;
                padding-top: 6px;
                padding-bottom: 0;
                position: static;
                background: transparent;
            }

            .editor-main-btn {
                min-width: 0;
                padding: 8px 6px;
                font-size: 0.85rem;
                border-radius: 12px;
            }

            .editor-flags-grid {
                grid-template-columns: repeat(4, minmax(0, 1fr));
                gap: 6px 8px;
                margin-top: 6px;
            }

            .editor-form-help {
                margin-top: 2px;
                font-size: 0.65rem;
            }

            .editor-color-label {
                font-size: 0.7rem !important;
                margin-top: 6px !important;
            }
        }


        #eventFormSection .editor-target-row {
            align-items: stretch !important;
        }

        #eventFormSection .editor-target-row > .editor-form-field:first-child {
            flex: 1 1 100%;
            max-width: 100%;
        }

        #evClassWrap {
            flex: 1 1 100% !important;
            width: 100% !important;
            max-width: 100% !important;
            margin-top: 8px;
        }

        #classButtonGroup.multi-grade-class-grid {
            grid-template-columns: 1fr;
            gap: 10px;
        }

        #classButtonGroup .choice-chip-grid {
            gap: 8px;
        }

    
        /* aligned spacing for team + all-school buttons */
        #calendarView.teachers-mode #fGen,
        #calendarView.teachers-mode #fAll {
            gap: 6px !important;
        }
        #calendarView.teachers-mode #fGen .btn-icon,
        #calendarView.teachers-mode #fAll .btn-icon {
            margin-inline-end: 0 !important;
        }
        #calendarView.teachers-mode #fGen .btn-text,
        #calendarView.teachers-mode #fAll .btn-text {
            white-space: nowrap;
        }

        /* compact equal-size teacher filter buttons */
        #calendarView.teachers-mode .main-filters {
            display: grid !important;
            grid-template-columns: repeat(5, 114px) !important;
            gap: 6px !important;
            justify-content: center !important;
            align-items: center !important;
            width: fit-content !important;
            max-width: 100% !important;
            margin-inline: auto !important;
        }

        #calendarView.teachers-mode .main-filters.with-print-inline {
            grid-template-columns: repeat(6, 114px) !important;
        }

        #calendarView.teachers-mode .main-filters > [data-v="z"],
        #calendarView.teachers-mode .main-filters > [data-v="h"],
        #calendarView.teachers-mode .main-filters > [data-v="t"],
        #calendarView.teachers-mode #fGen,
        #calendarView.teachers-mode #fAll {
            width: 114px !important;
            min-width: 114px !important;
            max-width: 114px !important;
            justify-self: stretch !important;
            grid-column: auto !important;
            grid-row: auto !important;
            padding: 4px 7px !important;
            min-height: 31px !important;
            border-radius: 14px !important;
            gap: 6px !important;
            justify-content: center !important;
            align-items: center !important;
            box-sizing: border-box !important;
        }

        #calendarView.teachers-mode .main-filters .btn-icon {
            width: 18px !important;
            height: 18px !important;
            font-size: 0.6rem !important;
            border-radius: 6px !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            line-height: 1 !important;
            margin: 0 !important;
            flex: 0 0 18px !important;
        }

        #calendarView.teachers-mode .main-filters .btn-text {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 0.8rem !important;
            line-height: 1 !important;
            min-height: 18px !important;
            margin: 0 !important;
        }

        @media (max-width: 768px) {
            #calendarView.teachers-mode .main-filters {
                display: grid !important;
                grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
                gap: 5px !important;
                width: 100% !important;
                max-width: 100% !important;
                margin-inline: auto !important;
                align-items: center !important;
            }

            #calendarView.teachers-mode .main-filters.with-print-inline {
                grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                grid-column: auto !important;
                grid-row: auto !important;
                justify-self: stretch !important;
                padding: 4px 3px !important;
                min-height: 30px !important;
                border-radius: 12px !important;
                gap: 5px !important;
                align-items: center !important;
            }

            #calendarView.teachers-mode .main-filters .btn-icon {
                width: 17px !important;
                height: 17px !important;
                font-size: 0.55rem !important;
                border-radius: 6px !important;
                flex: 0 0 17px !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text {
                font-size: 0.7rem !important;
                line-height: 1 !important;
                min-height: 17px !important;
            }
        }

        @media (max-width: 480px) {
            #calendarView.teachers-mode .main-filters {
                gap: 4px !important;
            }

            #calendarView.teachers-mode .main-filters.with-print-inline {
                grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                padding: 4px 2px !important;
                min-height: 29px !important;
                gap: 5px !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text {
                font-size: 0.7rem !important;
            }
        }


        /* unified icon-text spacing across all teacher filter buttons */
        #calendarView.teachers-mode .main-filters > button {
            gap: 6px !important;
        }
        #calendarView.teachers-mode .main-filters > button .btn-icon {
            margin-inline-start: 0 !important;
            margin-inline-end: 0 !important;
            margin: 0 !important;
        }
        #calendarView.teachers-mode .main-filters > button .btn-text {
            margin: 0 !important;
        }

        @media (max-width: 768px) {
            #calendarView.teachers-mode .main-filters > button {
                gap: 5px !important;
            }
            #calendarView.teachers-mode .main-filters > button .btn-icon {
                margin-inline-start: 0 !important;
                margin-inline-end: 0 !important;
                margin: 0 !important;
            }
        }



        /* final hard fix: identical icon-text spacing on all teacher filter buttons */
        #calendarView.teachers-mode .main-filters > button.filter-btn {
            display: inline-flex !important;
            flex-direction: row !important;
            direction: rtl !important;
            align-items: center !important;
            justify-content: center !important;
            gap: 6px !important;
            column-gap: 6px !important;
            row-gap: 0 !important;
        }
        #calendarView.teachers-mode .main-filters > button.filter-btn .btn-icon {
            order: 0 !important;
            margin: 0 !important;
            margin-inline-start: 0 !important;
            margin-inline-end: 0 !important;
            flex: 0 0 18px !important;
            width: 18px !important;
            height: 18px !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            line-height: 1 !important;
            transform: none !important;
            translate: none !important;
        }
        #calendarView.teachers-mode .main-filters > button.filter-btn .btn-text {
            order: 1 !important;
            flex: 0 0 auto !important;
            width: auto !important;
            min-width: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            line-height: 1 !important;
            text-align: center !important;
        }
        @media (max-width: 768px) {
            #calendarView.teachers-mode .main-filters > button.filter-btn {
                gap: 5px !important;
                column-gap: 5px !important;
            }
            #calendarView.teachers-mode .main-filters > button.filter-btn .btn-icon {
                flex-basis: 17px !important;
                width: 17px !important;
                height: 17px !important;
            }
        }


        /* mobile teacher toolbar cleanup */
        @media (max-width: 768px) {
            #calendarView.teachers-mode .top-controls-wrapper {
                padding: 8px 8px 10px;
            }

            #calendarView.teachers-mode .main-filters {
                display: flex !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: flex-start !important;
                gap: 8px !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 6px 0 0 !important;
                padding: 2px 2px 6px !important;
                overflow-x: auto !important;
                overflow-y: hidden !important;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                scroll-snap-type: x proximity;
            }

            #calendarView.teachers-mode .main-filters::-webkit-scrollbar {
                display: none;
            }

            #calendarView.teachers-mode .main-filters.with-print-inline {
                display: flex !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                flex: 0 0 104px !important;
                width: 104px !important;
                min-width: 104px !important;
                max-width: 104px !important;
                min-height: 34px !important;
                padding: 5px 10px !important;
                border-radius: 16px !important;
                gap: 6px !important;
                justify-content: center !important;
                align-items: center !important;
                scroll-snap-align: start;
            }

            #calendarView.teachers-mode #printBtn {
                flex: 0 0 38px !important;
                width: 38px !important;
                min-width: 38px !important;
                max-width: 38px !important;
                min-height: 34px !important;
                padding: 0 !important;
                border-radius: 14px !important;
                justify-content: center !important;
                align-items: center !important;
                scroll-snap-align: start;
            }

            #calendarView.teachers-mode .main-filters .btn-icon {
                width: 18px !important;
                height: 18px !important;
                flex: 0 0 18px !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                min-height: 18px !important;
                margin: 0 !important;
                font-size: 0.75rem !important;
                line-height: 1 !important;
                white-space: nowrap !important;
            }

            #calendarView.teachers-mode .grade-class-filter-bar {
                margin-top: 4px !important;
            }
        }

        @media (max-width: 480px) {
            #calendarView.teachers-mode .main-filters {
                gap: 7px !important;
                padding-bottom: 4px !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                flex-basis: 98px !important;
                width: 98px !important;
                min-width: 98px !important;
                max-width: 98px !important;
                padding: 5px 8px !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text {
                font-size: 0.75rem !important;
            }

            #calendarView.teachers-mode #printBtn {
                flex-basis: 36px !important;
                width: 36px !important;
                min-width: 36px !important;
                max-width: 36px !important;
            }
        }



        /* mobile match for class row */
        @media (max-width: 768px) {
            #calendarView.teachers-mode .grade-class-filter-bar {
                display: flex !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: flex-start !important;
                gap: 8px !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 6px 0 0 !important;
                padding: 2px 2px 6px !important;
                overflow-x: auto !important;
                overflow-y: hidden !important;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
            }

            #calendarView.teachers-mode .grade-class-filter-bar::-webkit-scrollbar {
                display: none;
            }

            #calendarView.teachers-mode .grade-class-filter-label {
                display: none !important;
            }

            #calendarView.teachers-mode .grade-class-filter-select {
                flex: 0 0 124px !important;
                width: 124px !important;
                min-width: 124px !important;
                max-width: 124px !important;
                min-height: 34px !important;
                height: 34px !important;
                padding: 5px 28px 5px 10px !important;
                border-radius: 16px !important;
                border: 1px solid rgba(203,213,225,0.9) !important;
                background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%) !important;
                box-shadow: 0 6px 14px rgba(15,23,42,0.06) !important;
                color: #1f2937 !important;
                font-size: 0.75rem !important;
                font-weight: 800 !important;
                line-height: 1 !important;
                text-align: center !important;
                text-align-last: center !important;
                appearance: none;
                -webkit-appearance: none;
                background-image: linear-gradient(45deg, transparent 50%, #475569 50%), linear-gradient(135deg, #475569 50%, transparent 50%);
                background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
                background-size: 5px 5px, 5px 5px;
                background-repeat: no-repeat;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn {
                flex: 0 0 38px !important;
                width: 38px !important;
                min-width: 38px !important;
                max-width: 38px !important;
                height: 34px !important;
                min-height: 34px !important;
                border-radius: 14px !important;
                border: 1px solid rgba(203,213,225,0.9) !important;
                background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%) !important;
                box-shadow: 0 6px 14px rgba(15,23,42,0.06) !important;
                color: #334155 !important;
                padding: 0 !important;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn svg {
                width: 17px !important;
                height: 17px !important;
            }
        }

        @media (max-width: 480px) {
            #calendarView.teachers-mode .grade-class-filter-bar {
                gap: 7px !important;
                padding-bottom: 4px !important;
            }

            #calendarView.teachers-mode .grade-class-filter-select {
                flex-basis: 116px !important;
                width: 116px !important;
                min-width: 116px !important;
                max-width: 116px !important;
                font-size: 0.75rem !important;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn {
                flex-basis: 36px !important;
                width: 36px !important;
                min-width: 36px !important;
                max-width: 36px !important;
            }
        }


        /* FINAL MOBILE TEACHER TOOLBAR LAYOUT — 3 fixed rows */
        @media (max-width: 768px) {
            #calendarView.teachers-mode .top-controls-wrapper {
                padding-bottom: 10px !important;
            }

            #calendarView.teachers-mode .main-filters {
                display: grid !important;
                grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
                grid-auto-rows: minmax(34px, auto) !important;
                gap: 6px !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 6px 0 0 !important;
                padding: 0 !important;
                overflow: visible !important;
                align-items: stretch !important;
                justify-items: stretch !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.with-print-inline {
                grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
            }

            #calendarView.teachers-mode #fGen {
                grid-row: 1 !important;
                grid-column: 1 !important;
            }

            #calendarView.teachers-mode #fAll {
                grid-row: 1 !important;
                grid-column: 2 !important;
            }

            #calendarView.teachers-mode #printBtn {
                grid-row: 1 !important;
                grid-column: 3 !important;
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                min-height: 34px !important;
                height: 34px !important;
                padding: 0 !important;
                border-radius: 14px !important;
                justify-content: center !important;
                align-items: center !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"] {
                grid-row: 2 !important;
                grid-column: 1 !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="h"] {
                grid-row: 2 !important;
                grid-column: 2 !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="t"] {
                grid-row: 2 !important;
                grid-column: 3 !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                min-height: 34px !important;
                height: 34px !important;
                padding: 4px 8px !important;
                border-radius: 14px !important;
                display: inline-flex !important;
                justify-content: center !important;
                align-items: center !important;
                gap: 6px !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters > button.filter-btn .btn-icon {
                width: 17px !important;
                height: 17px !important;
                flex: 0 0 17px !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters > button.filter-btn .btn-text {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                min-height: 17px !important;
                margin: 0 !important;
                font-size: 0.7rem !important;
                line-height: 1 !important;
                white-space: nowrap !important;
            }

            #calendarView.teachers-mode .grade-class-filter-bar {
                display: grid !important;
                grid-template-columns: minmax(0, 1fr) 38px !important;
                gap: 6px !important;
                align-items: center !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 6px 0 0 !important;
                padding: 0 !important;
                overflow: visible !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .grade-class-filter-label {
                display: none !important;
            }

            #calendarView.teachers-mode .grade-class-filter-select {
                grid-column: 1 !important;
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                min-height: 34px !important;
                height: 34px !important;
                padding: 5px 28px 5px 10px !important;
                border-radius: 14px !important;
                font-size: 0.7rem !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn {
                grid-column: 2 !important;
                width: 38px !important;
                min-width: 38px !important;
                max-width: 38px !important;
                height: 34px !important;
                min-height: 34px !important;
                border-radius: 14px !important;
                justify-self: stretch !important;
                align-self: stretch !important;
                padding: 0 !important;
            }
        }

        @media (max-width: 480px) {
            #calendarView.teachers-mode .main-filters {
                gap: 5px !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAll,
            #calendarView.teachers-mode #printBtn,
            #calendarView.teachers-mode .grade-class-filter-select,
            #calendarView.teachers-mode .grade-class-quick-print-btn {
                min-height: 33px !important;
                height: 33px !important;
            }

            #calendarView.teachers-mode .main-filters > button.filter-btn .btn-text,
            #calendarView.teachers-mode .grade-class-filter-select {
                font-size: 0.7rem !important;
            }

            #calendarView.teachers-mode .grade-class-filter-bar {
                gap: 5px !important;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn {
                width: 36px !important;
                min-width: 36px !important;
                max-width: 36px !important;
            }
        }


        /* final mobile teacher toolbar layout override */
        @media (max-width: 768px) {
            #calendarView.teachers-mode .top-controls-wrapper {
                padding: 8px 8px 10px !important;
            }

            #calendarView.teachers-mode .main-filters {
                display: grid !important;
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px !important;
                grid-template-areas:
                    "team all print"
                    "z h t" !important;
                gap: 8px !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 8px 0 0 !important;
                padding: 0 !important;
                overflow: visible !important;
                justify-content: stretch !important;
                align-items: stretch !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.with-print-inline {
                display: grid !important;
            }

            #calendarView.teachers-mode .main-filters > [data-v="team"] { grid-area: team !important; }
            #calendarView.teachers-mode .main-filters > [data-v="all"] { grid-area: all !important; }
            #calendarView.teachers-mode .main-filters > [data-v="z"] { grid-area: z !important; }
            #calendarView.teachers-mode .main-filters > [data-v="h"] { grid-area: h !important; }
            #calendarView.teachers-mode .main-filters > [data-v="t"] { grid-area: t !important; }
            #calendarView.teachers-mode #printBtn { grid-area: print !important; }

            #calendarView.teachers-mode .main-filters > [data-v="z"],
            #calendarView.teachers-mode .main-filters > [data-v="h"],
            #calendarView.teachers-mode .main-filters > [data-v="t"],
            #calendarView.teachers-mode #fGen,
            #calendarView.teachers-mode #fAdmin,
            #calendarView.teachers-mode #fAll {
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                min-height: 34px !important;
                padding: 5px 8px !important;
                border-radius: 16px !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 6px !important;
                box-sizing: border-box !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode #printBtn {
                width: 40px !important;
                min-width: 40px !important;
                max-width: 40px !important;
                min-height: 34px !important;
                height: 34px !important;
                padding: 0 !important;
                border-radius: 14px !important;
                justify-self: stretch !important;
                align-self: stretch !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters .btn-icon {
                width: 18px !important;
                height: 18px !important;
                flex: 0 0 18px !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                margin: 0 !important;
                min-height: 18px !important;
                font-size: 0.75rem !important;
                line-height: 1 !important;
                white-space: nowrap !important;
            }

            #calendarView.teachers-mode .grade-class-filter-bar {
                display: grid !important;
                grid-template-columns: minmax(0, 1fr) 40px !important;
                gap: 8px !important;
                align-items: center !important;
                width: 100% !important;
                max-width: 100% !important;
                margin: 8px 0 0 !important;
                padding: 0 !important;
                overflow: visible !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .grade-class-filter-label {
                display: none !important;
            }

            #calendarView.teachers-mode .grade-class-filter-select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                height: 34px !important;
                min-height: 34px !important;
                padding: 5px 28px 5px 10px !important;
                border-radius: 16px !important;
                font-size: 0.75rem !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .grade-class-quick-print-btn {
                width: 40px !important;
                min-width: 40px !important;
                max-width: 40px !important;
                height: 34px !important;
                min-height: 34px !important;
                padding: 0 !important;
                border-radius: 14px !important;
                margin: 0 !important;
                justify-self: stretch !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode .main-filters {
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px !important;
                gap: 7px !important;
            }

            #calendarView.teachers-mode #printBtn,
            #calendarView.teachers-mode .grade-class-quick-print-btn {
                width: 36px !important;
                min-width: 36px !important;
                max-width: 36px !important;
            }

            #calendarView.teachers-mode .main-filters .btn-text,
            #calendarView.teachers-mode .grade-class-filter-select {
                font-size: 0.75rem !important;
            }

            #calendarView.teachers-mode .grade-class-filter-bar {
                grid-template-columns: minmax(0, 1fr) 36px !important;
                gap: 7px !important;
            }
        }


        @media (max-width: 768px) {
            #calendarView.teachers-mode .top-controls-wrapper {
                padding: 8px 8px 10px !important;
            }

            #teacherMobileTopRow.teacher-mobile-top-row {
                display: none;
            }

            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: grid !important;
                grid-template-columns: 90px 90px 30px;
                gap: 5px !important;
                align-items: center;
                justify-content: center !important;
                margin-top: 6px !important;
                width: fit-content !important;
                max-width: 100% !important;
                margin-inline: auto !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
                justify-content: center !important;
                box-sizing: border-box !important;
                margin: 0 !important;
                padding: 4px 5px !important;
                min-height: 30px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                justify-content: center !important;
                padding: 0 !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                display: grid !important;
                grid-template-columns: repeat(3, 90px);
                gap: 5px !important;
                justify-content: center !important;
                width: fit-content !important;
                max-width: 100% !important;
                margin-top: 6px !important;
                margin-inline: auto !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
                justify-content: center !important;
                box-sizing: border-box !important;
                margin: 0 !important;
                padding: 4px 5px !important;
                min-height: 30px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > #fGen,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > #fAdmin,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > #printBtn {
                display: none !important;
            }


            #calendarView.teachers-mode #teacherMobileTopRow > #fGen .btn-text,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin .btn-text,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"] .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"] .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] .btn-text {
                font-size: 0.7rem !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen .btn-icon,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin .btn-icon,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"] .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"] .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] .btn-icon {
                width: 17px !important;
                height: 17px !important;
                flex: 0 0 17px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                display: grid !important;
                grid-template-columns: 96px 30px;
                gap: 5px !important;
                align-items: center;
                justify-content: center !important;
                width: fit-content !important;
                max-width: 100% !important;
                margin-top: 6px !important;
                margin-inline: auto !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-label {
                display: none !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: none !important;
                margin: 0 !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                justify-content: center !important;
                padding: 0 !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                grid-template-columns: 84px 84px 28px !important;
                gap: 4px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                width: 84px !important;
                min-width: 84px !important;
                max-width: 84px !important;
                padding: 4px 4px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                grid-template-columns: 92px 28px !important;
                gap: 4px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 92px !important;
                max-width: 92px !important;
                font-size: 0.65rem !important;
                padding: 2px 6px !important;
                min-height: 28px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 84px) !important;
                gap: 4px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 84px !important;
                min-width: 84px !important;
                max-width: 84px !important;
                padding: 4px 4px !important;
            }
        }


        /* mobile teacher toolbar fine-tune: top-row print inline, unified button widths */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: grid !important;
                grid-template-columns: 94px 94px 32px !important;
                gap: 6px !important;
                align-items: center !important;
                justify-content: center !important;
                width: max-content !important;
                max-width: 100% !important;
                margin-top: 6px !important;
                margin-inline: auto !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 94px !important;
                min-width: 94px !important;
                max-width: 94px !important;
                height: 32px !important;
                min-height: 32px !important;
                padding: 4px 8px !important;
                border-radius: 14px !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 6px !important;
                box-sizing: border-box !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 32px !important;
                min-width: 32px !important;
                max-width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
                align-self: center !important;
                justify-self: center !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                padding: 0 !important;
                margin: 0 !important;
                border-radius: 14px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                padding-inline: 9px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen .btn-icon,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin .btn-icon,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"] .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"] .btn-icon,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] .btn-icon {
                width: 17px !important;
                height: 17px !important;
                flex: 0 0 17px !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen .btn-text,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin .btn-text,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"] .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"] .btn-text,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] .btn-text {
                font-size: 0.7rem !important;
                line-height: 1 !important;
                min-height: 17px !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 94px) !important;
                gap: 6px !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                grid-template-columns: 90px 90px 30px !important;
                gap: 5px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 90px) !important;
                gap: 5px !important;
            }
        }


        /* final hard fix: mobile teachers top row keeps print on the same row */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: inline-flex !important;
                flex-direction: row !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 6px !important;
                width: auto !important;
                max-width: 100% !important;
                margin: 6px auto 0 !important;
                direction: rtl !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                width: 92px !important;
                min-width: 92px !important;
                max-width: 92px !important;
                height: 32px !important;
                min-height: 32px !important;
                padding: 4px 8px !important;
                margin: 0 !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 6px !important;
                box-sizing: border-box !important;
                white-space: nowrap !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                padding-inline: 10px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                position: static !important;
                order: 3 !important;
                width: 32px !important;
                min-width: 32px !important;
                max-width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
                padding: 0 !important;
                margin: 0 !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                border-radius: 14px !important;
                flex: 0 0 32px !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                gap: 5px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAdmin,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                width: 88px !important;
                min-width: 88px !important;
                max-width: 88px !important;
                height: 30px !important;
                min-height: 30px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                flex-basis: 30px !important;
            }
        }


        .search-filter-wrap-no-label {
            margin-top: 8px;
        }

        .search-filter-wrap-no-label select {
            min-width: 0;
            width: 100%;
        }

        .search-input-wrap button {
            min-width: 84px;
            width: auto;
            padding: 9px 14px;
            flex: 0 0 auto;
        }

        @media (max-width: 768px) {
            .search-input-wrap {
                flex-direction: row;
                align-items: center;
                gap: 8px;
                flex-wrap: nowrap;
            }

            .search-input-wrap input {
                min-width: 0;
                flex: 1 1 auto;
            }

            .search-input-wrap button {
                width: auto !important;
                min-width: 72px !important;
                padding: 8px 12px !important;
                flex: 0 0 auto !important;
                white-space: nowrap;
            }

            .search-filter-wrap-no-label {
                margin-top: 8px;
            }

            .search-filter-wrap-no-label select {
                width: 100%;
                min-width: 0;
            }
        }


        /* final mobile cleanup: center first row, tighten row gaps, clean search header */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: grid !important;
                grid-template-columns: 32px 94px 94px !important;
                width: 294px !important;
                max-width: 294px !important;
                align-items: center !important;
                justify-content: center !important;
                justify-items: center !important;
                gap: 6px !important;
                margin: 2px auto 2px !important;
                padding: 0 !important;
                box-sizing: border-box !important;
                direction: rtl !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                order: 1 !important;
                width: 32px !important;
                min-width: 32px !important;
                max-width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
                padding: 0 !important;
                margin: 0 !important;
                flex: 0 0 32px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode #teacherMobileTopRow > #fGen {
                width: 94px !important;
                min-width: 94px !important;
                max-width: 94px !important;
                height: 32px !important;
                min-height: 32px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 94px) !important;
                width: 294px !important;
                max-width: 294px !important;
                gap: 6px !important;
                margin: 2px auto 2px !important;
                justify-content: center !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                width: 294px !important;
                max-width: 294px !important;
                grid-template-columns: 32px 1fr !important;
                gap: 6px !important;
                margin: 2px auto 4px !important;
                justify-content: center !important;
                align-items: center !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 32px !important;
                min-width: 32px !important;
                max-width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
                margin: 0 !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                margin: 0 !important;
                width: 100% !important;
                min-width: 0 !important;
            }

            .search-modal-subtitle {
                display: none !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                grid-template-columns: 30px 88px 88px !important;
                width: 274px !important;
                max-width: 274px !important;
                gap: 5px !important;
                margin: 1px auto 1px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                flex-basis: 30px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode #teacherMobileTopRow > #fGen {
                width: 88px !important;
                min-width: 88px !important;
                max-width: 88px !important;
                height: 30px !important;
                min-height: 30px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 88px) !important;
                width: 274px !important;
                max-width: 274px !important;
                gap: 5px !important;
                margin: 1px auto 1px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                width: 274px !important;
                max-width: 274px !important;
                grid-template-columns: 30px 1fr !important;
                gap: 5px !important;
                margin: 1px auto 3px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
            }
        }


        /* final mobile teacher toolbar fix: compact 3 rows, no overlap */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: grid !important;
                grid-template-columns: 30px 90px 90px !important;
                width: 282px !important;
                max-width: 282px !important;
                direction: ltr !important;
                justify-content: center !important;
                justify-items: center !important;
                align-items: center !important;
                gap: 6px !important;
                margin: 2px auto 2px !important;
                padding: 0 !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                grid-column: 1 !important;
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 0 !important;
                justify-self: center !important;
                align-self: center !important;
                flex: 0 0 30px !important;
                border-radius: 14px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                grid-column: 2 !important;
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen {
                grid-column: 3 !important;
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                display: grid !important;
                grid-template-columns: repeat(3, 90px) !important;
                width: 282px !important;
                max-width: 282px !important;
                direction: ltr !important;
                justify-content: center !important;
                justify-items: center !important;
                align-items: center !important;
                gap: 6px !important;
                margin: 2px auto 2px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 90px !important;
                min-width: 90px !important;
                max-width: 90px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                display: grid !important;
                grid-template-columns: 30px 246px !important;
                width: 282px !important;
                max-width: 282px !important;
                direction: ltr !important;
                justify-content: center !important;
                justify-items: center !important;
                align-items: center !important;
                gap: 6px !important;
                margin: 2px auto 4px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 30px !important;
                min-width: 30px !important;
                max-width: 30px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 0 !important;
                justify-self: center !important;
                align-self: center !important;
                border-radius: 14px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 246px !important;
                min-width: 246px !important;
                max-width: 246px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 2px 10px !important;
                box-sizing: border-box !important;
            }

            .search-filter-wrap.search-filter-wrap-no-label {
                display: none !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                grid-template-columns: 28px 84px 84px !important;
                width: 264px !important;
                max-width: 264px !important;
                gap: 6px !important;
                margin: 2px auto 1px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
                flex-basis: 28px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 84px !important;
                min-width: 84px !important;
                max-width: 84px !important;
                height: 28px !important;
                min-height: 28px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                grid-template-columns: repeat(3, 84px) !important;
                width: 264px !important;
                max-width: 264px !important;
                gap: 6px !important;
                margin: 1px auto 1px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                grid-template-columns: 28px 230px !important;
                width: 264px !important;
                max-width: 264px !important;
                gap: 6px !important;
                margin: 1px auto 3px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 230px !important;
                min-width: 230px !important;
                max-width: 230px !important;
                height: 28px !important;
                min-height: 28px !important;
            }
        }


        /* final mobile teacher toolbar layout */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row {
                display: flex !important;
                flex-direction: row !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: center !important;
                direction: rtl !important;
                gap: 6px !important;
                width: 270px !important;
                max-width: 270px !important;
                margin: 2px auto 4px !important;
                padding: 0 !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen {
                order: 1 !important;
                width: 86px !important;
                min-width: 86px !important;
                max-width: 86px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
                flex: 0 0 86px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                order: 2 !important;
                width: 86px !important;
                min-width: 86px !important;
                max-width: 86px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
                flex: 0 0 86px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn {
                order: 3 !important;
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
                margin: 0 !important;
                padding: 0 !important;
                border-radius: 14px !important;
                box-sizing: border-box !important;
                flex: 0 0 28px !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row {
                display: flex !important;
                flex-direction: row !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: center !important;
                direction: rtl !important;
                gap: 6px !important;
                width: 270px !important;
                max-width: 270px !important;
                margin: 0 auto 4px !important;
                padding: 0 !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 86px !important;
                min-width: 86px !important;
                max-width: 86px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 4px 8px !important;
                box-sizing: border-box !important;
                flex: 0 0 86px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                display: flex !important;
                flex-direction: row !important;
                flex-wrap: nowrap !important;
                align-items: center !important;
                justify-content: center !important;
                direction: rtl !important;
                gap: 6px !important;
                width: 270px !important;
                max-width: 270px !important;
                margin: 0 auto 6px !important;
                padding: 0 !important;
                box-sizing: border-box !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                order: 1 !important;
                width: 236px !important;
                min-width: 236px !important;
                max-width: 236px !important;
                height: 30px !important;
                min-height: 30px !important;
                margin: 0 !important;
                padding: 2px 10px !important;
                box-sizing: border-box !important;
                flex: 0 0 236px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                order: 2 !important;
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
                margin: 0 !important;
                padding: 0 !important;
                border-radius: 14px !important;
                box-sizing: border-box !important;
                flex: 0 0 28px !important;
            }

            /* ensure hidden filters do not keep space */
            .search-filter-wrap.search-filter-wrap-no-label {
                display: none !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                width: 252px !important;
                max-width: 252px !important;
                gap: 5px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 80px !important;
                min-width: 80px !important;
                max-width: 80px !important;
                height: 28px !important;
                min-height: 28px !important;
                flex-basis: 80px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 26px !important;
                min-width: 26px !important;
                max-width: 26px !important;
                height: 26px !important;
                min-height: 26px !important;
                flex-basis: 26px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 221px !important;
                min-width: 221px !important;
                max-width: 221px !important;
                height: 28px !important;
                min-height: 28px !important;
                flex-basis: 221px !important;
            }
        }


        /* final mobile polish: clear active state correctly + slightly wider buttons */
        @media (max-width: 768px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                width: 288px !important;
                max-width: 288px !important;
                gap: 6px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 92px !important;
                min-width: 92px !important;
                max-width: 92px !important;
                height: 31px !important;
                min-height: 31px !important;
                flex-basis: 92px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                padding-inline: 10px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
                flex-basis: 28px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 254px !important;
                min-width: 254px !important;
                max-width: 254px !important;
                height: 31px !important;
                min-height: 31px !important;
                flex-basis: 254px !important;
            }
        }

        @media (max-width: 420px) {
            #calendarView.teachers-mode #teacherMobileTopRow.teacher-mobile-top-row,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row {
                width: 270px !important;
                max-width: 270px !important;
                gap: 5px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fGen,
            #calendarView.teachers-mode #teacherMobileTopRow > #fAll,
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="z"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="h"],
            #calendarView.teachers-mode .main-filters.teacher-mobile-grades-row > [data-v="t"] {
                width: 86px !important;
                min-width: 86px !important;
                max-width: 86px !important;
                height: 30px !important;
                min-height: 30px !important;
                flex-basis: 86px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #fAll {
                padding-inline: 10px !important;
            }

            #calendarView.teachers-mode #teacherMobileTopRow > #printBtn,
            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-quick-print-btn {
                width: 26px !important;
                min-width: 26px !important;
                max-width: 26px !important;
                height: 26px !important;
                min-height: 26px !important;
                flex-basis: 26px !important;
            }

            #calendarView.teachers-mode #gradeClassFilterBar.teacher-mobile-class-row .grade-class-filter-select {
                width: 239px !important;
                min-width: 239px !important;
                max-width: 239px !important;
                height: 30px !important;
                min-height: 30px !important;
                flex-basis: 239px !important;
            }
        }


        #calendarView.teachers-mode[data-current-filter="all"] #gradeClassFilterBar,
        #calendarView.teachers-mode[data-current-filter="team"] #gradeClassFilterBar {
            display: none !important;
        }

    
        @media (min-width: 769px) {
            #calendarView.teachers-mode .main-filters {
                display: flex !important;
                flex-wrap: nowrap !important;
                justify-content: center !important;
                align-items: center !important;
                gap: 8px !important;
                overflow-x: auto;
                overflow-y: hidden;
                padding-bottom: 2px;
            }
            
            
            
        }

/* ── אזהרת עומס מבחנים ───────────────────────────── */
.exam-overload-banner {
  background: #fdf0d5;
  border: 1.5px solid #e67e22;
  border-radius: 8px;
  color: #b35900;
  font-size: 12px;
  font-weight: bold;
  padding: 6px 14px;
  margin: 4px 0 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  direction: rtl;
  flex-wrap: wrap;
}
.exam-overload-banner .exam-banner-item {
  background: #ffe0b2;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  margin: 2px 0;
}





/* Event Templates */



#quickAddPopup{display:none;position:fixed;z-index:8000;background:#fff;border:1px solid #cbd5e1;border-radius:10px;padding:12px 14px;box-shadow:0 4px 20px rgba(0,0,0,0.15);width:230px;direction:rtl;}
#quickAddPopup.open{display:block;}
#quickAddPopup h4{margin:0 0 8px;font-size:13px;color:#334155;}
#quickAddTitle{width:100%;box-sizing:border-box;border:1px solid #cbd5cf;border-radius:6px;padding:6px 8px;font-size:13px;font-family:inherit;margin-bottom:8px;}
.qa-btns{display:flex;gap:6px;}
.qa-btn{flex:1;border:none;border-radius:6px;padding:6px 0;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;}
.qa-add{background:#68a824;color:#fff;}
.qa-add:hover{background:#5a9020;}
.qa-more{background:#eef1f4;color:#475569;}
.qa-more:hover{background:#e2e8f0;}
.qa-cancel{background:none;border:none;position:absolute;top:6px;left:8px;font-size:16px;cursor:pointer;color:#6b7280;padding:0;}
.day-drop-hover{background:rgba(104,168,36,0.12)!important;outline:2px dashed #68a824!important;}
#notifyDayBtn {
    display:flex; align-items:center; gap:7px;
    background:#0a8f4f; color:#fff; border:none;
    border-radius:8px; padding:9px 18px; font-size:13px;
    font-weight:700; cursor:pointer; font-family:inherit;
    margin:10px auto 2px; width:calc(100% - 28px);
    justify-content:center;
}
#notifyDayBtn:hover { background:#097a43; }




        .ticker-bar {
            display: flex; align-items: center; gap: 8px;
            margin: 8px auto 4px; max-width: 820px; width: 100%;
            /* 29.09.2026 — אפור אצל כולם, בלי קשר לשכבה או לקהל */
            background: linear-gradient(90deg,#eef1f4,#f8faf9);
            border: 1.5px solid #dddddd; border-radius: 12px;
            padding: 6px 10px; box-sizing: border-box;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06); direction: rtl;
        }
        .ticker-bar-icon { font-size: 17px; flex: 0 0 auto; }
        .ticker-viewport { flex: 1 1 auto; overflow: hidden; position: relative; height: 24px; }
        .ticker-track {
            display: inline-flex; gap: 48px; white-space: nowrap;
            position: absolute; right: 0; top: 0; height: 24px; align-items: center;
            will-change: transform; animation: tickerScroll linear infinite;
        }
        .ticker-track:hover { animation-play-state: paused; }
        .ticker-item { font-size: 14px; font-weight: 700; color: #334155; }
        .ticker-item .ticker-tag {
            font-size: 11px; font-weight: 800; color: #fff; background: #64748b;
            border-radius: 6px; padding: 1px 6px; margin-left: 6px;
        }
        @keyframes tickerScroll {
            from { transform: translateX(-100%); }
            to   { transform: translateX(100%); }
        }
        .ticker-manage-btn {
            flex: 0 0 auto; background: #fff; border: 1px solid #dddddd;
            border-radius: 8px; cursor: pointer; font-size: 14px; padding: 3px 7px;
        }
        .ticker-manage-btn:hover { background: #eef1f4; }
        .ticker-grade-pick {
            font-family: inherit; font-size: 13px; font-weight: 700; color: #34495e; background: #fff;
            border: 1px solid #cbd5e1; border-radius: 8px; padding: 5px 9px;
            display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
        }
        .ticker-list-item {
            border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px 11px;
            background: #ffffff; display: flex; align-items: flex-start; gap: 8px;
        }
        .ticker-list-item.expired { opacity: 0.55; background: #eef1f4; }
        .ticker-list-item .tli-text { flex: 1 1 auto; font-size: 13px; color: #334155; }
        .ticker-list-item .tli-meta { font-size: 11px; color: #6b7280; margin-top: 3px; }
        .ticker-list-item .tli-del {
            flex: 0 0 auto; background: #fde8e8; color: #c0392b; border: none;
            border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 800; padding: 4px 9px;
        }
        .ticker-list-item .tli-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; }
        .tli-notify {
            flex: 0 0 auto; background: #eef2ff; color: #1e4f8a; border: 1px solid #c3d9f5;
            border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 800; padding: 4px 9px; white-space: nowrap;
        }
        .tli-notify:hover { background: #e3f2fd; }
        /* בורר קהל יעד בהודעות שוטפות */
        .tk-aud-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
        .tk-aud-row > .tk-aud-grade-label { font-size: 12px; font-weight: 800; color: #34495e; min-width: 46px; }
        .tk-class-chip {
            border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px;
            padding: 4px 11px; cursor: pointer; font-size: 12px; font-weight: 800; transition: 0.15s ease; font-family: inherit;
        }
        .tk-class-chip.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0f8a46, #54b26d); }
        .tk-team-chip { border: 1px solid #cbd5e1; background: #fff; color: #2e7d32; }
        .tk-team-chip.active { color: #fff; border-color: transparent; background: #2e7d32; }
        .tk-aud-divider { height: 1px; background: #e2e8f0; margin: 10px 0 4px; }

        /* 29.09.2026 — נגישות במסך הבית: שטח לחיצה של 44 פיקסלים לפחות,
           וטקסט משנה באריחים לא קטן מ-11 פיקסלים. הצבע מתוך הפלטה הקיימת. */
        .home-aud-btn, #homeAudSys, .notify-entry-btn, #installEntryBtn { min-height: 44px; }
        .home-tile-sub, #mainMenuView.ym-on #homeTiles .home-tile .home-tile-sub, #homeSysTiles .home-tile .home-tile-sub { font-size: 11px !important; color: #334155 !important; }
        .site-build { font-size: 11px !important; }
