.newfs-feedback-button {
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.newfs-feedback-button:hover,
.newfs-chat-toggle:hover {
    transform: translateY(-1px);
}

.newfs-chat-toggle {
    position: fixed;
    right: 1rem;
    bottom: 5rem;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: #4f46e5;
    color: #fff;
    padding: 0;
    box-shadow: 0 18px 40px rgba(79, 70, 229, 0.25);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.newfs-chat-toggle:hover {
    background: #4338ca;
}
.newfs-chat-unread-badge.hidden {
    display: none;
}

.newfs-chat-unread-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 9999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    padding: 0 0.25rem;
}

.newfs-chat-toggle.is-hidden {
    display: none;
}

.newfs-chat-widget {
    position: fixed;
    right: 1rem;
    bottom: 5rem;
    z-index: 45;
    width: min(420px, calc(100vw - 2rem));
    height: min(660px, calc(100dvh - 7rem));
    overflow: hidden;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.28);
}

.newfs-chat-frame {
    width: 100%;
    height: calc(100% - 58px);
    border: 0;
    background: #fff;
}

.newfs-chat-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    color: #fff;
}

.newfs-chat-icon-button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.newfs-chat-collapsed {
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #4f46e5;
    color: #fff;
}

.newfs-chat-widget.is-collapsed {
    width: 3rem;
    height: auto;
    border-radius: 9999px;
}

.newfs-chat-widget.is-collapsed > div:first-child,
.newfs-chat-widget.is-collapsed .newfs-chat-frame {
    display: none;
}

.newfs-chat-widget.is-collapsed .newfs-chat-collapsed {
    display: flex !important;
}

.dog-detail-hero-card,
.dog-detail-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #fff;
    padding: 1.25rem;
}

.dog-detail-hero-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.dog-detail-photo-column {
    min-width: 0;
}

.dog-detail-main-photo-wrap,
.dog-detail-empty-photo {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
}

.dog-detail-main-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dog-detail-empty-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
}

.dog-detail-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.dog-detail-thumb {
    width: 3.5rem;
    height: 3.5rem;
    flex: 0 0 auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    object-fit: cover;
}

.dog-detail-gallery-photo {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f3f4f6;
}

.dog-detail-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
}

.dog-detail-sidebar > * + * {
    margin-top: 0 !important;
}

.dog-detail-tabs {
    border-radius: 0.75rem 0.75rem 0 0;
    background: #fff;
    padding: 0 1rem;
}

.dog-health-breeding-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.dog-health-breeding-grid table {
    min-width: 36rem;
}

.dog-detail-fact-row {
    display: grid;
    grid-template-columns: 8.75rem minmax(0, 1fr);
    gap: 0.75rem;
}

.dog-detail-fact-row dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dog-detail-card > :first-child {
    margin-top: 0;
}

.dog-detail-card .dog-litter-preview,
.dog-detail-card .dog-offspring-preview,
.dog-detail-card .pedigree-grid {
    background: #fff;
}

@media (min-width: 1280px) {
    .dog-detail-hero-grid {
        grid-template-columns: 280px minmax(0, 1fr) 220px;
        gap: 2rem;
    }

    .dog-health-breeding-grid {
        grid-template-columns: minmax(0, 2fr) minmax(18rem, 0.85fr);
    }

    .dog-health-breeding-grid--single {
        grid-template-columns: minmax(0, 1fr);
    }

    .dog-detail-sidebar {
        grid-column: auto;
        display: block;
    }

    .dog-detail-sidebar > * + * {
        margin-top: 0.75rem !important;
    }
}

/* At Tailwind's lg boundary the desktop controls fit, but the quick navigation
   leaves no useful width for search. Keep search in the primary row and move
   that navigation to a full-width row until the xl layout has enough room. */
@media (min-width: 1024px) and (max-width: 1279px) {
    [data-header-primary-row] {
        flex-wrap: wrap;
    }

    [data-header-primary-row] form[data-portal-search] {
        max-width: none;
    }

    [data-header-quick-nav] {
        order: 10;
        flex: 0 0 100%;
    }
}

@media (max-width: 767px) {
    .dog-detail-hero-card,
    .dog-detail-card {
        padding: 0.9rem;
        border-radius: 0.6rem;
    }

    .dog-detail-hero-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dog-detail-photo-column {
        width: 100%;
        max-width: 26rem;
        margin: 0 auto;
    }

    .dog-detail-sidebar {
        display: block;
    }

    .dog-detail-sidebar > * + * {
        margin-top: 0.75rem !important;
    }

    .dog-detail-tabs {
        margin-left: -0.65rem;
        margin-right: -0.65rem;
        border-radius: 0;
    }

    .dog-detail-fact-row {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }
}

@media (max-width: 390px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body > header > div:first-child {
        gap: 0.45rem;
        padding: 0.35rem 0.65rem;
    }

    header img[alt="Newfs.pro"] {
        width: 2rem;
        height: 2rem;
    }

    header form[data-portal-search] {
        max-width: none;
    }

    header form[data-portal-search] > div {
        padding: 0.4rem 0.6rem;
    }

    header form[data-portal-search] input {
        min-width: 0;
        font-size: 0.875rem;
    }

    header nav[aria-label] {
        gap: 0.4rem;
        padding-left: 0.65rem;
        padding-right: 0.65rem;
        padding-bottom: 0.45rem;
        scrollbar-width: none;
    }

    header nav[aria-label]::-webkit-scrollbar {
        display: none;
    }

    header nav[aria-label] a {
        flex: 0 0 auto;
        padding: 0.35rem 0.75rem;
        font-size: 0.8125rem;
    }

    header a[aria-label="Уведомления"],
    header a[title="Баланс кредитов"] {
        width: 2.25rem;
        height: 2.25rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        font-size: 0.8125rem;
    }

    body > div.mx-auto.grid.max-w-screen-2xl {
        gap: 0.75rem;
        padding: 0.75rem 0.65rem;
    }

    main h1 {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    main h2 {
        font-size: 1.05rem;
        line-height: 1.25;
    }

    main .bg-white.border.rounded-lg,
    main article.rounded-lg.border.bg-white,
    main section.rounded-lg.border.bg-white {
        padding: 0.75rem;
        border-radius: 0.5rem;
    }

    main .p-6 {
        padding: 0.75rem !important;
    }

    main .p-5,
    main .p-4 {
        padding: 0.75rem !important;
    }

    main .mt-6 {
        margin-top: 1rem;
    }

    main .mb-6 {
        margin-bottom: 1rem;
    }

    main .gap-6 {
        gap: 0.9rem;
    }

    main .gap-4 {
        gap: 0.65rem;
    }

    main .flex.items-center.justify-between {
        align-items: flex-start;
        gap: 0.75rem;
    }

    main .flex.items-center.justify-between > .flex,
    main .flex.items-center.justify-between > .flex.flex-wrap {
        width: 100%;
        justify-content: flex-start;
    }

    main table {
        max-width: 100%;
    }

    main td,
    main th {
        word-break: break-word;
    }

    .dog-offspring-preview {
        border: 0;
        background: transparent;
    }

    .dog-offspring-preview table,
    .dog-offspring-preview tbody {
        display: block;
    }

    .dog-offspring-preview tbody {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.25rem 0;
    }

    .dog-offspring-preview tr {
        display: block;
        border: 0;
        max-width: 100%;
    }

    .dog-offspring-preview td {
        display: none;
    }

    .dog-offspring-preview td:first-child {
        display: block;
        padding: 0;
    }

    .dog-offspring-preview td:first-child a {
        display: block;
        max-width: 10.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        border: 1px solid #c7d2fe;
        border-radius: 9999px;
        background: #eef2ff;
        padding: 0.3rem 0.55rem;
        font-size: 0.78rem;
        line-height: 1.15;
    }

    .dog-offspring-preview td:first-child div {
        display: none;
    }

    .dog-litter-preview table,
    .dog-litter-preview thead,
    .dog-litter-preview tbody,
    .dog-litter-preview tr,
    .dog-litter-preview td {
        display: block;
    }

    .dog-litter-preview thead {
        display: none;
    }

    .dog-litter-preview tr {
        padding: 0.65rem;
    }

    .dog-litter-preview td {
        padding: 0.15rem 0;
        font-size: 0.8125rem;
    }

    .dog-litter-preview td:first-child {
        font-weight: 700;
    }

    #litters-list {
        gap: 0.75rem;
    }

    #litters-list article {
        padding: 0.75rem;
    }

    #litters-list article a.text-lg {
        font-size: 1rem;
    }

    #litters-list article .mt-4.grid > div {
        padding: 0.5rem 0.6rem;
        border-radius: 0.45rem;
    }

    #litters-list article .flex.flex-wrap.gap-2 {
        gap: 0.35rem;
    }

    #litters-list article .flex.flex-wrap.gap-2 a,
    #litters-list article .flex.flex-wrap.gap-2 span.rounded {
        max-width: 9.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        line-height: 1.15;
    }

    .newfs-feedback-button {
        right: 0.75rem;
        bottom: 0.75rem;
        width: 2.75rem;
        height: 2.75rem;
    }

    .newfs-chat-toggle {
        right: 0.75rem;
        bottom: 4.1rem;
        width: 2.75rem;
        height: 2.75rem;
        justify-content: center;
        padding: 0;
        font-size: 0.8125rem;
    }

    .newfs-chat-toggle span {
        display: none;
    }

    .newfs-chat-widget {
        right: 0.5rem;
        bottom: 4.1rem;
        width: calc(100vw - 1rem);
        height: calc(100dvh - 5rem);
        border-radius: 0.65rem;
    }

    .newfs-chat-widget.is-collapsed {
        width: 2.75rem;
        right: 0.75rem;
        bottom: 4.1rem;
    }
}
