/* ============================================================
   NEWS + NOTIFICATIONS  (мобильный скролл-фикс)
   Десктоп — без изменений. Правки только в @media (max-width: 900px)
   Настройка ширины карточки: см. блок «карточки» в мобильной секции.
   ============================================================ */

.nn-block {
    width: 1400px;
    height: 699px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: 668px 668px;
    gap: 64px;
    align-items: start;
}
.nn-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.nn-column.nn-news {
    width: 668px;
    max-width: 100%;
    height: 699px;
}
.nn-column.nn-notifications {
    width: 668px;
    max-width: 100%;
    height: 699px;
}
.nn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 33px;
    height: 36px;
    flex-shrink: 0;
}
.nn-news .nn-header {
    width: 650px;
    max-width: 100%;
}
.nn-notifications .nn-header {
    flex-direction: row-reverse;
    width: 651px;
    max-width: 100%;
    margin-left: auto;
}
.nn-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}
.nn-all-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #000000;
    text-decoration: none;
    transition: all 0.3s ease;
}
.nn-all-link svg {
    width: 18px;
    height: 12px;
}
.nn-news .nn-all-link:hover { color: #22B822; }
.nn-notifications .nn-all-link:hover { color: #2B52B8; }
.nn-notifications .nn-all-link {
    flex-direction: row-reverse;
}
.nn-notifications .nn-all-link svg {
    transform: rotate(180deg);
}
.nn-news-list {
    display: flex;
    flex-direction: column;
    flex: 1; align-items: flex-start; justify-content: space-between;
}
.nn-news-item {
    width: 650px;
    height: 199px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #EDEDED;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    overflow: hidden;
    flex: none;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0;
    margin-right: auto;
    align-self: flex-start;
}
.nn-news-item:hover {
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.nn-news-link {
    display: flex;
    align-items: stretch;
    gap: 21px;
    padding: 19px 20px 20px 20px;
    text-decoration: none;
    color: inherit;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}
.nn-news-image {
    width: 160px;
    height: 160px;
    min-width: 160px;
    min-height: 160px;
    max-height: 160px;
    border-radius: 30px;
    overflow: hidden;
    background: #F3F4F6;
    flex-shrink: 0;
}
.nn-news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}
.nn-news-item:hover .nn-news-image img {
    transform: scale(1.05);
}
.nn-news-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.nn-news-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}
.nn-news-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: #22B822;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #FFFFFF;
    box-shadow: inset 0 3px 1px rgba(0, 0, 0, 0.25);
}
.nn-news-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #9CA3AF;
    margin-left: auto;
}
.nn-news-date svg {
    width: 14px;
    height: 14px;
    stroke: #9CA3AF;
}
.nn-news-title {
    font-size: 17px;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background-image: linear-gradient(#22B822, #22B822);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.4s ease, color 0.3s ease;
    padding-bottom: 2px;
    margin-bottom: 7px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.nn-news-item:hover .nn-news-title {
    color: #22B822 !important;
    background-size: 100% 2px !important;
}
.nn-news-excerpt {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}
@media (min-width: 1101px) {
    .nn-news-excerpt { -webkit-line-clamp: 2; }
}
.nn-notifications-list {
    display: flex;
    flex-direction: column;
    flex: 1; justify-content: space-between;
    align-items: flex-end;
}
.nn-notif-item {
    width: 651px;
    height: 150px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 15px;
    border: 1px solid #EDEDED;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    overflow: hidden;
    flex: none;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0;
    margin-left: auto;
    align-self: flex-end;
}
.nn-notif-item:hover {
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.nn-notif-link {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: start;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    height: 100%;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}
.nn-notif-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #2B52B8;
    border: none;
    box-shadow: inset 0 3px 1px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}
.nn-notif-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2B52B8;
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 12px;
}
.nn-notif-icon svg {
    width: 20px;
    height: 26px;
    position: relative;
    z-index: 1;
    transition: transform 0.5s ease;
}
.nn-notif-item:hover .nn-notif-icon::before {
    opacity: 1;
}
.nn-notif-item:hover .nn-notif-icon svg {
    animation: bellRing 0.6s ease-in-out;
    transform-origin: top center;
}
@keyframes bellRing {
    0%   { transform: rotate(0deg); }
    15%  { transform: rotate(14deg); }
    30%  { transform: rotate(-12deg); }
    45%  { transform: rotate(10deg); }
    60%  { transform: rotate(-8deg); }
    75%  { transform: rotate(4deg); }
    90%  { transform: rotate(-2deg); }
    100% { transform: rotate(0deg); }
}
.nn-notif-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    justify-content: flex-start;
    overflow: hidden;
}
.nn-notif-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: inset 0 3px 1px rgba(0, 0, 0, 0.25);
}
.nn-notif-badge.is-urgent { background: #D03434; color: #FFFFFF; }
.nn-notif-badge.is-planned { background: #2B52B8; color: #FFFFFF; }
.nn-notif-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #1F2937;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background-image: linear-gradient(#2B52B8, #2B52B8);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.4s ease, color 0.3s ease;
    padding-bottom: 2px;
    margin-bottom: 3px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.nn-notif-item:hover .nn-notif-title {
    color: #2B52B8 !important;
    background-size: 100% 2px !important;
}
.nn-notif-excerpt {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #798188;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.nn-notif-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
    align-self: stretch;
}
.nn-notif-date {
    font-size: 12px;
    color: #9CA3AF;
    white-space: nowrap;
    flex-shrink: 0;
}
.nn-empty {
    text-align: center;
    padding: 40px 20px;
    background: #F9FAFB;
    border-radius: 16px;
    color: #6B7280;
    font-size: 15px;
}

/* ============================================================
   ПЛАНШЕТ / ПРОМЕЖУТОЧНЫЙ — только мелкие правки размеров
   ============================================================ */
@media (max-width: 1100px) {
    .nn-block { gap: 40px; padding: 30px 20px; }
    .nn-title { font-size: 24px; }
    .nn-news-image {
        width: 120px; height: 85px;
        min-width: 120px; min-height: 85px; max-height: 85px;
    }
    .nn-news-item { min-height: 125px; }
    .nn-notif-link { padding: 12px 16px; }
}

/* ============================================================
   МОБИЛЬНЫЙ  <= 900px — горизонтальные ленты

   ГЕОМЕТРИЯ (подбирается двумя числами):
     --nn-side : боковой отступ ленты (= отступ заголовка), задан padding-left
     - 40px    : насколько карточка УЖЕ ленты (это и есть «хвост» след. карточки)

   Сейчас: слева 16px, карточка = 100% контейнера − 40px, хвост ≈ 24px.
   Хотите карточки ещё шире — уменьшайте 40px (например, 24px → хвост 8px).
   ============================================================ */
@media (max-width: 900px) {

    .nn-block {
        display: block !important;          /* grid → обычный поток, надёжнее */
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* высоты 699px заданы селекторами из ДВУХ классов — перекрываем так же */
    .nn-column,
    .nn-column.nn-news,
    .nn-column.nn-notifications {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 0 24px 0 !important;
        overflow: visible !important;
        border: none !important;
        background: transparent !important;
    }
    .nn-column.nn-notifications { margin-bottom: 0 !important; }

    .nn-header {
        height: auto !important;
        margin-bottom: 14px !important;
        padding: 0 16px !important;         /* = padding-left ленты, чтобы выровнять */
        width: 100% !important;
        max-width: 100% !important;
    }
    .nn-title { font-size: 17px !important; }
    .nn-all-link { font-size: 14px !important; }

    /* ---------- горизонтальные ленты ---------- */
    .nn-news-list,
    .nn-notifications-list {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;   /* сброс space-between */
        align-items: stretch !important;          /* сброс flex-start / flex-end */
        gap: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        flex: none !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scroll-padding-left: 16px;
        padding: 5px 0 8px 16px !important;       /* правого паддинга нет — отступ даёт ::after */
        box-sizing: border-box !important;
    }

    /* отступ в КОНЦЕ прокрутки.
       padding-right у flex-скроллера мобильные браузеры в scrollWidth не считают,
       поэтому добавляем пустой flex-элемент — он гарантированно учитывается */
    .nn-news-list::after,
    .nn-notifications-list::after {
        content: '';
        flex: 0 0 16px;
        width: 16px;
        height: 1px;
    }

    .nn-news-list::-webkit-scrollbar,
    .nn-notifications-list::-webkit-scrollbar { display: none; }
    .nn-news-list,
    .nn-notifications-list { scrollbar-width: none; -ms-overflow-style: none; }

    /* ---------- карточки ----------
       calc(100% - 40px): 100% — внутренняя ширина ленты (уже без padding-left).
       Число 40px = «хвост» следующей карточки. Меняйте только его.           */
    .nn-news-item,
    .nn-notif-item {
        flex: 0 0 calc(100% - 40px) !important;
        width: calc(100% - 40px) !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;          /* сброс margin-right/left: auto из десктопа */
        align-self: stretch !important;/* сброс flex-start / flex-end */
        scroll-snap-align: start;
        box-sizing: border-box !important;
    }

    /* --- карточка новости --- */
    .nn-news-link {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 16px !important;
        height: auto !important;
    }
    .nn-news-image {
        width: 100% !important;
        height: 190px !important;
        min-width: 0 !important;
        min-height: 190px !important;
        max-height: 190px !important;
    }
    .nn-news-title { font-size: 17px !important; -webkit-line-clamp: 2; }
    .nn-news-excerpt { font-size: 14px !important; -webkit-line-clamp: 3; }

    /* --- карточка уведомления --- */
    .nn-notif-link {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 18px !important;
        height: auto !important;
    }
    .nn-notif-icon { width: 48px !important; height: 48px !important; min-width: 48px !important; }
    .nn-notif-icon svg { width: 24px !important; height: 24px !important; }
    .nn-notif-content { width: 100% !important; }
    .nn-notif-title { font-size: 17px !important; -webkit-line-clamp: 2; }
    .nn-notif-excerpt { font-size: 14px !important; -webkit-line-clamp: 3; }
    .nn-notif-side {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        align-self: flex-start !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .nn-notif-date { font-size: 13px !important; }
}

/* очень узкие экраны: хвост делаем чуть меньше, чтобы карточка не сужалась */
@media (max-width: 400px) {
    .nn-news-item,
    .nn-notif-item {
        flex: 0 0 calc(100% - 32px) !important;
        width: calc(100% - 32px) !important;
    }
    .nn-news-image {
        height: 165px !important;
        min-height: 165px !important;
        max-height: 165px !important;
    }
}

/* сброс «залипания» подчёркивания заголовков в конце файла (как было у вас) */
.nn-news-item:hover .nn-news-title {
    color: #1F2937;
    background-size: 0% 2px;
}
