

/* Popup UI migrated from S1. These rules are intentionally scoped to the
   existing dashboard modal so the dashboard layout and shared controls stay intact. */
#chicken-modal .chicken-modal-dialog.is-detail-showcase,
#chicken-modal .chicken-modal-dialog.is-edit-showcase {
    width: min(1180px, calc(100vw - 40px));
    max-height: min(920px, calc(100vh - 40px));
    padding: 0;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    background: #f5f7f4;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

/* ========================================================================== 
   Edit chicken modal — farm cost Master Modal design language
   Strictly scoped to edit mode; the chicken detail popup is intentionally
   excluded and keeps its independent composition.
   ========================================================================== */
#chicken-modal.chicken-modal.is-edit-mode:not([hidden]) {
    display: grid !important;
    place-items: center !important;
    padding: 20px !important;
    overflow: hidden !important;
}

#chicken-modal.is-edit-mode .chicken-modal-backdrop {
    background: rgba(9, 15, 11, .52) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
}

#chicken-modal.is-edit-mode #chicken-modal-dialog.chicken-modal-dialog.is-edit-showcase.modal-size-large {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: min(720px, calc(100vw - 40px)) !important;
    min-width: 0 !important;
    max-width: 720px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(88dvh, 820px) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    color: #172019 !important;
    background: #ffffff !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .1) !important;
    font-family: "Prompt", "Noto Sans Thai", sans-serif !important;
    animation: edit-chicken-dialog-in 180ms cubic-bezier(.22, 1, .36, 1) both !important;
}

@keyframes edit-chicken-dialog-in {
    from {
        opacity: .94;
        transform: translateY(8px) scale(.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-modal-header {
    position: relative !important;
    min-height: 0 !important;
    padding: 24px 60px 18px 24px !important;
    display: block !important;
    flex: 0 0 auto !important;
    background: #ffffff !important;
    border: 0 !important;
    border-bottom: 1px solid #e3e9e5 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .modal-header-title {
    min-width: 0 !important;
    display: block !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase #chicken-modal-title {
    margin: 0 !important;
    color: #172019 !important;
    font-size: 1.3rem !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    letter-spacing: -.018em !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase #chicken-modal-eyebrow {
    display: block !important;
    max-width: 65ch !important;
    margin: 4px 0 0 !important;
    color: #66736c !important;
    font-size: .82rem !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .modal-header-actions {
    display: none !important;
}

/* Removed legacy 32px .is-edit-showcase .modal-close-button override to use Master close button */

#chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-edit-form:not([hidden]) {
    min-height: 0 !important;
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 2px 24px 0 !important;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    scrollbar-width: thin !important;
    scrollbar-color: #b5c0b9 transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__body::-webkit-scrollbar {
    width: 8px;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__body::-webkit-scrollbar-thumb {
    background: #b5c0b9;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-card {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 22px 0 24px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    color: #172019 !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid #e3e9e5 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-card:first-child {
    padding-top: 16px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-card:last-child {
    padding-bottom: 28px !important;
    border-bottom: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-section-heading,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-form-section-heading {
    min-width: 0 !important;
    grid-column: 1 / -1 !important;
    margin: 0 0 2px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    color: #172019 !important;
    background: transparent !important;
    border: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-form-section-heading > span {
    width: 32px !important;
    height: 32px !important;
    flex: 0 0 32px !important;
    display: grid !important;
    place-items: center !important;
    color: #183f2c !important;
    background: #eef4f0 !important;
    border: 1px solid #d8e4dc !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-form-section-heading > span i {
    color: currentColor !important;
    font-size: .95rem !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase :is(.edit-showcase-section-heading, .chicken-form-section-heading) h3 {
    margin: 0 !important;
    color: #172019 !important;
    font-size: .98rem !important;
    font-weight: 650 !important;
    line-height: 1.4 !important;
    letter-spacing: -.01em !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase :is(.edit-showcase-section-heading, .chicken-form-section-heading) p {
    max-width: 68ch !important;
    margin: 2px 0 0 !important;
    color: #66736c !important;
    font-size: .78rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-grid {
    min-width: 0 !important;
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .fight-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field {
    min-width: 0 !important;
    grid-column: auto !important;
    display: grid !important;
    align-content: start !important;
    gap: 7px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #172019 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-full {
    grid-column: 1 / -1 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field > label {
    margin: 0 !important;
    color: #29332d !important;
    font-size: .82rem !important;
    font-weight: 550 !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-required,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field > label > span[aria-hidden="true"] {
    color: #b93f3f !important;
    font-size: .88em !important;
    font-weight: 700 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    color: #172019 !important;
    background: #ffffff !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: .875rem !important;
    font-weight: 400 !important;
    caret-color: #183f2c !important;
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field textarea {
    min-height: 96px !important;
    padding: 10px 12px !important;
    line-height: 1.55 !important;
    resize: vertical !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea):hover:not(:disabled):not([readonly]) {
    border-color: #aeb8b1 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea):focus {
    border-color: #17653d !important;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, .12) !important;
    outline: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea)[readonly],
#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea):disabled {
    color: #78817b !important;
    background: #f1f3f2 !important;
    border-color: #e0e5e2 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea).invalid,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field :is(input, select, textarea)[aria-invalid="true"] {
    background: #fffafa !important;
    border-color: #b93f3f !important;
    box-shadow: 0 0 0 3px rgba(185, 63, 63, .08) !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .form-hint {
    margin: 0 !important;
    color: #66736c !important;
    font-size: .75rem !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .form-error {
    min-height: 0 !important;
    margin: 0 !important;
    color: #a93636 !important;
    font-size: .76rem !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .form-error:empty {
    display: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control {
    position: relative !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control > i {
    position: absolute !important;
    z-index: 2 !important;
    top: 50% !important;
    left: 12px !important;
    font-size: 15px !important;
    line-height: 1 !important;
    color: #66736c !important;
    transform: translateY(-50%) !important;
    pointer-events: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: opacity 0.15s ease, visibility 0.15s ease !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control.has-value > i,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control.is-filled > i,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control:has(input[type="text"]:not(:placeholder-shown)) > i {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control > input[type="text"] {
    padding-left: 36px !important;
    padding-right: 12px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-menu {
    margin-top: 2px !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    box-shadow: 0 12px 30px rgba(23, 32, 25, .12) !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-readonly-history {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
    margin: 2px 0 0 !important;
    padding: 14px 16px !important;
    color: #445149 !important;
    background: #f7f9f7 !important;
    border: 1px solid #e3e9e5 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .media-upload-field > input[type="file"] {
    width: 100% !important;
    min-height: 42px !important;
    padding: 5px !important;
    color: #66736c !important;
    background: #ffffff !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    font: inherit !important;
    font-size: .8rem !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .media-upload-field > input[type="file"]::file-selector-button {
    height: 30px !important;
    margin-right: 10px !important;
    padding: 0 12px !important;
    color: #314239 !important;
    background: #f3f6f4 !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 6px !important;
    font: inherit !important;
    font-weight: 550 !important;
    cursor: pointer !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .media-image-manager,
#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-video-preview {
    margin-top: 2px !important;
    padding: 12px !important;
    background: #f7f9f7 !important;
    border: 1px dashed #cbd6cf !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .media-main-image-preview {
    border-radius: 8px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__actions {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 16px 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex: 0 0 auto !important;
    background: #ffffff !important;
    border: 0 !important;
    border-top: 1px solid #e3e9e5 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button {
    min-width: 112px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: .84rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 100ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button--secondary {
    color: #314239 !important;
    background: #ffffff !important;
    border: 1px solid #d5dcd7 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button--secondary:hover {
    color: #183f2c !important;
    background: #f3f6f4 !important;
    border-color: #aeb8b1 !important;
    transform: none !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button--primary {
    color: #ffffff !important;
    background: #17653d !important;
    border: 1px solid #17653d !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button--primary:hover:not(:disabled) {
    color: #ffffff !important;
    background: #102f20 !important;
    border-color: #102f20 !important;
    box-shadow: 0 8px 18px rgba(16, 47, 32, .16) !important;
    transform: translateY(-1px) !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase :is(.modal-close-button, .edit-chicken-button, input, select, textarea):focus-visible {
    outline: 3px solid rgba(24, 63, 44, .16) !important;
    outline-offset: 2px !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button:disabled {
    opacity: .58 !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed !important;
}

@media (max-width: 640px) {
    #chicken-modal.chicken-modal.is-edit-mode:not([hidden]) {
        padding: 10px !important;
    }

    #chicken-modal.is-edit-mode #chicken-modal-dialog.chicken-modal-dialog.is-edit-showcase.modal-size-large {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 12px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .chicken-modal-header {
        padding: 20px 54px 15px 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .modal-close-button {
        top: 14px !important;
        right: 14px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__body {
        padding-right: 18px !important;
        padding-left: 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-card,
    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-field,
    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-form-full {
        grid-column: 1 !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-dialog__actions {
        padding: 14px 18px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-chicken-button {
        width: 100% !important;
        min-width: 0 !important;
    }
}



@media (max-width: 420px) {
    #chicken-modal #chicken-modal-dialog.is-edit-showcase #chicken-modal-title {
        font-size: 1.16rem !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.is-edit-showcase .edit-showcase-card {
        padding-top: 18px !important;
        padding-bottom: 20px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chicken-modal #chicken-modal-dialog.is-edit-showcase,
    #chicken-modal #chicken-modal-dialog.is-edit-showcase * {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

#chicken-modal .chicken-modal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 82px;
    padding: 16px 20px 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
}

#chicken-modal .modal-header-title {
    min-width: 180px;
    margin-right: auto;
}

#chicken-modal .modal-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #558163;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

#chicken-modal .modal-header-actions:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
}

#chicken-modal .modal-header-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #dce5de;
    border-radius: 11px;
    color: #244332;
    background: #fff;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 750;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

#chicken-modal .modal-header-action-button:hover,
#chicken-modal .modal-header-action-button:focus-visible {
    border-color: #73a884;
    color: #0f6b3c;
    background: #f0f8f2;
    transform: translateY(-1px);
    outline: none;
}

#chicken-modal .modal-header-action-button.action-sell {
    border-color: #17653d;
    color: #fff;
    background: #17653d;
}

#chicken-modal .modal-header-action-button.action-sell:hover,
#chicken-modal .modal-header-action-button.action-sell:focus-visible {
    color: #fff;
    background: #0f5130;
}

#chicken-modal .modal-close-button {
    flex: 0 0 40px;
    border-radius: 50% !important;
}

#chicken-modal .chicken-detail-view:not([hidden]) {
    display: block;
    padding: 22px;
}

#chicken-modal .detail-showcase-layout {
    display: grid;
    grid-template-columns: minmax(270px, 0.68fr) minmax(0, 1.32fr);
    gap: 20px;
    align-items: start;
}

#chicken-modal .detail-showcase-sidebar,
#chicken-modal .detail-showcase-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}

#chicken-modal .showcase-main-image,
#chicken-modal .showcase-record-card,
#chicken-modal .showcase-media-card,
#chicken-modal .showcase-overview-card,
#chicken-modal .showcase-history-card,
#chicken-modal .showcase-additional-card {
    border: 1px solid #e4e9e5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 69, 42, 0.06);
}

#chicken-modal .showcase-main-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e8eee9;
}

#chicken-modal .showcase-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

#chicken-modal .showcase-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

#chicken-modal .showcase-thumbnail {
    aspect-ratio: 1;
    padding: 2px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

#chicken-modal .showcase-thumbnail.is-active {
    border-color: #1f7a4c;
}

#chicken-modal .showcase-thumbnail img {
    width: 100%;
    height: 100%;
    border-radius: 7px;
    object-fit: cover;
}

#chicken-modal .showcase-record-card {
    padding: 18px;
    color: #fff;
    border-color: #174b31;
    background: linear-gradient(135deg, #0e3f27, #1c6a43);
}

#chicken-modal .showcase-record-card span,
#chicken-modal .showcase-record-card strong {
    display: block;
}

#chicken-modal .showcase-record-card span {
    margin-bottom: 7px;
    color: #bfe2ca;
    font-size: 0.76rem;
    font-weight: 750;
}

#chicken-modal .showcase-record-card strong {
    line-height: 1.55;
    font-size: 1rem;
    white-space: pre-wrap;
}

#chicken-modal .showcase-media-card,
#chicken-modal .showcase-overview-card,
#chicken-modal .showcase-history-card {
    padding: 20px;
}

#chicken-modal .showcase-media-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 0.96rem;
}

#chicken-modal .showcase-media-card video,
#chicken-modal .edit-video-preview video,
#chicken-modal #video-preview video {
    display: block;
    width: 100%;
    max-height: 300px;
    border-radius: 13px;
    background: #101712;
}

#chicken-modal .showcase-video-placeholder,
#chicken-modal .edit-media-empty {
    display: grid;
    place-items: center;
    gap: 7px;
    min-height: 116px;
    padding: 18px;
    border: 1px dashed #cbd8ce;
    border-radius: 13px;
    color: #758078;
    background: #f7faf7;
    text-align: center;
}

#chicken-modal .showcase-video-placeholder i,
#chicken-modal .edit-media-empty i {
    font-size: 1.6rem;
}

#chicken-modal .showcase-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf0ed;
}

#chicken-modal .showcase-title-row span {
    color: #6c7b70;
    font-size: 0.78rem;
    font-weight: 800;
}

#chicken-modal .showcase-title-row h2 {
    margin: 4px 0 0;
    color: #17251b;
    font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

#chicken-modal .showcase-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 22px 0 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid #edf0ed;
    color: #244332;
    font-size: 0.93rem;
    font-weight: 800;
    scroll-margin-top: 112px;
}

#chicken-modal .showcase-section-title.is-highlighted {
    color: #08783e;
    background: #eaf7ee;
}

#chicken-modal .showcase-fact-grid,
#chicken-modal .showcase-lineage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

#chicken-modal .showcase-fact-grid > div,
#chicken-modal .showcase-lineage-grid > div,
#chicken-modal .showcase-health-panel > div,
#chicken-modal .showcase-vaccine-panel > div {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 13px 14px;
    border-radius: 12px;
    background: #f5f8f5;
}

#chicken-modal .showcase-fact-grid span,
#chicken-modal .showcase-lineage-grid span,
#chicken-modal .showcase-health-panel span,
#chicken-modal .showcase-vaccine-panel span {
    color: #718077;
    font-size: 0.73rem;
}

#chicken-modal .showcase-fact-grid strong,
#chicken-modal .showcase-lineage-grid strong,
#chicken-modal .showcase-health-panel strong,
#chicken-modal .showcase-vaccine-panel strong {
    overflow-wrap: anywhere;
    color: #1f3025;
    font-size: 0.9rem;
}

#chicken-modal .showcase-health-panel,
#chicken-modal .showcase-vaccine-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

#chicken-modal .showcase-vaccine-panel {
    margin-top: 10px;
}

#chicken-modal .showcase-vaccine-panel > div {
    background: #fff8e9;
}

/* =====================================================
   ข้อมูลเพิ่มเติม (3 Option Cards Tab System)
   ===================================================== */
#chicken-modal .showcase-additional-card {
    padding: 20px;
}

#chicken-modal .additional-tab-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 16px;
}

#chicken-modal .additional-tab-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 80px;
    padding: 12px 14px;
    background: #ffffff;
    color: #333333;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#chicken-modal .additional-tab-card:hover {
    background: #fafafa;
    border-color: #bbbbbb;
    color: #111111;
    transform: translateY(-1px);
}

#chicken-modal .additional-tab-card:focus-visible {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

#chicken-modal .additional-tab-card.is-active {
    background: #f6f6f6;
    color: #111111;
    border-color: #111111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#chicken-modal .additional-tab-card.is-active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 18px;
    right: 18px;
    height: 2px;
    background: #111111;
    border-radius: 2px;
}

#chicken-modal .additional-tab-card .tab-card-icon {
    font-size: 20px;
    line-height: 1;
    color: #555555;
    transition: color 0.18s ease;
}

#chicken-modal .additional-tab-card.is-active .tab-card-icon {
    color: #111111;
}

#chicken-modal .additional-tab-card .tab-card-title {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

#chicken-modal .additional-tab-content-area {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

#chicken-modal .additional-tab-panel {
    display: none;
    opacity: 0;
    transition: opacity 150ms ease;
}

#chicken-modal .additional-tab-panel.is-active:not([hidden]) {
    display: block;
    opacity: 1;
}

/* ต้นทุนสะสม (Cost Summary Box & List) */
#chicken-modal .chicken-cost-summary-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 14px;
    background: #f7f9f8;
    border: 1px solid #e3e9e5;
    border-radius: 12px;
}

#chicken-modal .chicken-cost-summary-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#chicken-modal .chicken-cost-summary-label {
    color: #66736c;
    font-size: 12.5px;
    font-weight: 500;
}

#chicken-modal .chicken-cost-summary-amount {
    color: #172019;
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#chicken-modal .chicken-cost-summary-count {
    padding: 4px 12px;
    background: #ffffff;
    border: 1px solid #e3e9e5;
    border-radius: 20px;
    color: #556159;
    font-size: 12px;
    font-weight: 600;
}

#chicken-modal .cost-history-card .cost-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#chicken-modal .cost-category-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0f4f1;
    color: #2e593d;
    font-size: 11px;
    font-weight: 600;
}

#chicken-modal .cost-amount-badge {
    color: #17653d;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#chicken-modal .cost-history-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
    color: #7a877e;
    font-size: 12px;
}

#chicken-modal .cost-history-details {
    margin: 6px 0 0;
    color: #58665c;
    font-size: 13px;
}

#chicken-modal .detail-empty-value {
    padding: 16px;
    border-radius: 12px;
    color: #758078;
    background: #f5f8f5;
    text-align: center;
}

#chicken-modal .history-list {
    display: grid;
    gap: 10px;
}

#chicken-modal .history-card {
    padding: 14px;
    border: 1px solid #e3e9e4;
    border-radius: 12px;
    background: #fff;
}

#chicken-modal .history-card > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

#chicken-modal .history-card p {
    margin: 7px 0 0;
    color: #58665c;
    font-size: 0.82rem;
}

#chicken-modal .history-card time {
    color: #7a877e;
    font-size: 0.75rem;
}

#chicken-modal .detail-showcase-edit:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
    grid-template-areas:
        "media info"
        "fight info"
        "actions actions";
    gap: 18px;
    align-items: start;
    padding: 22px;
}

#chicken-modal .edit-showcase-info-group {
    grid-area: info;
    display: grid;
    gap: 0;
    overflow: visible;
    border: 1px solid #e4e9e5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 69, 42, 0.05);
}

#chicken-modal .edit-showcase-info-group > .edit-showcase-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#chicken-modal .edit-showcase-info-group > .edit-showcase-card:first-child {
    border-radius: 18px 18px 0 0;
}

#chicken-modal .edit-showcase-info-group > .edit-showcase-card:last-child {
    border-radius: 0 0 18px 18px;
}

#chicken-modal .edit-showcase-info-group > .edit-showcase-card + .edit-showcase-card {
    border-top: 1px solid #e7ece8;
}

#chicken-modal .edit-showcase-media { grid-area: media; }
#chicken-modal .edit-showcase-fight { grid-area: fight; }
#chicken-modal .detail-showcase-edit .edit-form-actions { grid-area: actions; }

#chicken-modal .detail-showcase-edit .edit-showcase-card {
    margin: 0;
    padding: 18px;
    border: 1px solid #e4e9e5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 69, 42, 0.05);
}

#chicken-modal .edit-showcase-section-heading {
    margin-bottom: 16px;
}

#chicken-modal .edit-showcase-section-heading h3 {
    margin: 3px 0 0;
}

#chicken-modal .showcase-kicker {
    color: #4f8060;
    font-size: 0.73rem;
    font-weight: 800;
}

#chicken-modal .detail-showcase-edit .edit-form-grid {
    gap: 13px;
}

#chicken-modal .detail-showcase-edit input,
#chicken-modal .detail-showcase-edit select,
#chicken-modal .detail-showcase-edit textarea {
    border-color: #dce4de;
    background: #f9fbf9;
}

#chicken-modal .detail-showcase-edit input:focus,
#chicken-modal .detail-showcase-edit select:focus,
#chicken-modal .detail-showcase-edit textarea:focus {
    border-color: #33865a;
    box-shadow: 0 0 0 3px rgba(51, 134, 90, 0.13);
}

#chicken-modal .detail-showcase-edit :disabled,
#chicken-modal .detail-showcase-edit [readonly] {
    color: #6f7a72;
    background: #f0f3f0;
    cursor: not-allowed;
}

#chicken-modal .edit-main-image-preview {
    position: relative;
    min-height: 210px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 14px;
    background: #edf2ee;
}

#chicken-modal .edit-main-image-preview > img {
    width: 100%;
    height: 240px;
    object-fit: cover;
}

#chicken-modal .edit-main-image-preview > span {
    position: absolute;
    left: 12px;
    bottom: 12px;
    padding: 6px 9px;
    border-radius: 999px;
    color: #fff;
    background: rgba(10, 62, 35, 0.88);
    font-size: 0.72rem;
    font-weight: 800;
}

#chicken-modal .edit-showcase-thumbnails {
    grid-template-columns: 1fr;
    margin-top: 10px;
}

#chicken-modal .edit-thumbnail-item {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid #dce5de;
    border-radius: 12px;
}

#chicken-modal .edit-thumbnail-item > img {
    width: 78px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
}

#chicken-modal .edit-preview-state {
    color: #587061;
    font-size: 0.76rem;
    font-weight: 700;
}

#chicken-modal .edit-thumbnail-actions {
    grid-column: 2;
}

#chicken-modal .edit-thumbnail-actions button,
#chicken-modal .edit-media-danger-button,
#chicken-modal .edit-media-restore-button {
    padding: 7px 10px;
    border: 1px solid #e5d2d2;
    border-radius: 8px;
    color: #a33b3b;
    background: #fff7f7;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 750;
    cursor: pointer;
}

#chicken-modal .edit-media-restore-button {
    width: 100%;
    margin-top: 10px;
    border-color: #cfe1d3;
    color: #247047;
    background: #f2faf4;
}

#chicken-modal .edit-video-preview {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

#chicken-modal .edit-video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#chicken-modal .edit-readonly-history {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

#chicken-modal .edit-readonly-history details {
    padding: 12px;
    border: 1px solid #e1e8e2;
    border-radius: 12px;
    background: #f8faf8;
}

#chicken-modal .edit-readonly-history summary {
    color: #294735;
    font-weight: 800;
    cursor: pointer;
}

#chicken-modal .edit-readonly-history summary span {
    float: right;
    color: #819087;
    font-size: 0.7rem;
    font-weight: 600;
}

#chicken-modal .detail-showcase-edit .edit-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 0 -22px -22px;
    padding: 15px 22px;
    border-top: 1px solid #e3e8e4;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
    #chicken-modal .detail-showcase-layout,
    #chicken-modal .detail-showcase-edit:not([hidden]) {
        grid-template-columns: 1fr;
    }

    #chicken-modal .detail-showcase-edit:not([hidden]) {
        grid-template-areas: "media" "info" "fight" "actions";
    }

    #chicken-modal .detail-showcase-sidebar {
        grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
    }

    #chicken-modal .showcase-main-image {
        grid-row: span 2;
    }

    #chicken-modal .modal-header-actions {
        max-width: 55vw;
        overflow-x: auto;
    }

    #chicken-modal .modal-header-action-button span {
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    #chicken-modal .chicken-modal-dialog.is-detail-showcase,
    #chicken-modal .chicken-modal-dialog.is-edit-showcase {
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }

    #chicken-modal .chicken-modal-header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 13px 14px;
    }

    #chicken-modal .modal-header-title {
        width: calc(100% - 52px);
    }

    #chicken-modal .modal-header-actions:not([hidden]) {
        order: 3;
        width: 100%;
        max-width: none;
        padding-bottom: 2px;
    }

    #chicken-modal .modal-header-action-button {
        min-width: max-content;
        min-height: 38px;
        padding-inline: 11px;
    }

    #chicken-modal .chicken-detail-view:not([hidden]),
    #chicken-modal .detail-showcase-edit:not([hidden]) {
        padding: 14px;
    }

    #chicken-modal .detail-showcase-sidebar,
    #chicken-modal .showcase-fact-grid,
    #chicken-modal .showcase-lineage-grid,
    #chicken-modal .showcase-health-panel,
    #chicken-modal .showcase-vaccine-panel {
        grid-template-columns: 1fr;
    }

    #chicken-modal .showcase-main-image {
        grid-row: auto;
    }

    #chicken-modal .health-history-content {
        padding-left: 0;
    }

    #chicken-modal .additional-tab-list {
        gap: 8px;
    }

    #chicken-modal .additional-tab-card {
        min-height: 72px;
        padding: 8px 6px;
        gap: 5px;
    }

    #chicken-modal .additional-tab-card .tab-card-icon {
        font-size: 18px;
    }

    #chicken-modal .additional-tab-card .tab-card-title {
        font-size: 11.5px;
    }

    #chicken-modal .detail-showcase-edit .edit-form-actions {
        margin: 0 -14px -14px;
        padding: 12px 14px;
    }
}

/* ==================================================
   DELETE CHICKEN CONFIRMATION
================================================== */
#chicken-modal .modal-header-action-button.action-delete {
    border-color: #efc9c5 !important;
    background: #fff2f0 !important;
    color: #a92f27 !important;
}

#chicken-modal .modal-header-action-button.action-delete:hover {
    border-color: #b63830 !important;
    background: #b63830 !important;
    color: #ffffff !important;
}

.delete-chicken-confirm[hidden],
#chicken-action-confirm[hidden],
.dashboard-confirm-modal[hidden] {
    display: none !important;
}

.delete-chicken-confirm:not([hidden]),
#chicken-action-confirm:not([hidden]),
.dashboard-confirm-modal:not([hidden]) {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1000000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.delete-chicken-confirm-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: default;
}

/* ==================================================
   ประวัติสุขภาพและการรักษา
================================================== */
.health-history-action-button {
    border-color: #b7c8bd;
    background: #f4f8f5;
    color: #214c32;
}

.treatment-action-button {
    border-color: #b89454;
    background: #fff8ea;
    color: #75500f;
}

.health-history-action-button:hover,
.treatment-action-button:hover {
    transform: translateY(-1px);
    filter: brightness(0.97);
}

#chicken-modal .modal-size-medium .health-history-popup {
    padding: 22px;
}

.health-history-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #e0e8e2;
    border-radius: 16px;
    background: #f7faf8;
}

.health-history-popup-header span,
.health-history-popup-header small {
    display: block;
    color: #67736a;
}

.health-history-popup-header strong {
    display: block;
    margin: 2px 0;
    color: #17251c;
    font-size: 20px;
}

.health-latest-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.health-latest-item {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid #e5ebe7;
    border-radius: 14px;
    background: #ffffff;
}

.health-latest-item span,
.health-latest-item strong {
    display: block;
}

.health-latest-item span {
    margin-bottom: 5px;
    color: #78827b;
    font-size: 12px;
}

.health-latest-item strong {
    color: #1f2922;
    overflow-wrap: anywhere;
}

.history-popup-section + .history-popup-section {
    margin-top: 24px;
}

.history-popup-section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.history-popup-section-heading i {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: #173e27;
    color: #ffffff;
}

.history-popup-section-heading h3 {
    margin: 0;
    font-size: 17px;
}

.treatment-history-list {
    display: grid;
    gap: 12px;
}

.treatment-history-card {
    padding: 15px 16px;
    border: 1px solid #e2e8e4;
    border-radius: 15px;
    background: #ffffff;
}

.treatment-history-card-head,
.treatment-history-actions,
.vaccine-history-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.treatment-history-card p {
    margin: 10px 0;
    color: #38443c;
    white-space: pre-wrap;
}

.treatment-history-card small {
    color: #758078;
}

.treatment-history-actions,
.vaccine-history-actions {
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid #edf1ee;
}

.treatment-history-actions button,
.vaccine-history-actions button {
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid #cfd9d2;
    border-radius: 10px;
    background: #ffffff;
    color: #294734;
    cursor: pointer;
}

.treatment-history-actions .treatment-delete-button,
.vaccine-history-actions .vaccine-delete-button {
    border-color: #efcbc8;
    color: #a23129;
}

.pill-autocomplete {
    position: relative;
}

.pill-autocomplete-control {
    position: relative;
}

.pill-autocomplete-control > i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: #7a857d;
    transform: translateY(-50%);
    pointer-events: none;
}

.pill-autocomplete-control input[type="text"] {
    width: 100%;
    padding-left: 40px;
}

.pill-autocomplete-menu {
    position: absolute;
    top: calc(100% - 10px);
    right: 0;
    left: 0;
    z-index: 80;
    max-height: 240px;
    overflow-y: auto;
    padding: 7px;
    border: 1px solid #dce5df;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 16px 35px rgba(25, 45, 32, 0.16);
}

.pill-autocomplete-option,
.pill-autocomplete-add,
.pill-autocomplete-empty {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #26352b;
    text-align: left;
}

button.pill-autocomplete-option,
button.pill-autocomplete-add {
    cursor: pointer;
}

button.pill-autocomplete-option:hover,
button.pill-autocomplete-option.is-active,
button.pill-autocomplete-add:hover {
    background: #eef6f0;
    color: #174526;
}

.pill-autocomplete-add {
    color: #246236;
    font-weight: 600;
}

@media (max-width: 640px) {
    .health-latest-grid {
        grid-template-columns: 1fr;
    }

    .health-history-popup-header,
    .treatment-history-card-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

.chicken-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: 1500px;
    max-height: 94vh;
    
    padding: 32px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition:
        opacity var(--motion-normal, 220ms) ease,
        transform var(--motion-normal, 220ms) var(--motion-ease, ease);
}

.detail-media-item {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #e8eeea;
    border-radius: 13px;
}

/* Labels for the reusable multiple-image preview (first image is primary). */
.image-preview-grid:not(.edit-showcase-thumbnails) .image-preview-item > span {
    position: absolute;
    left: 7px;
    bottom: 7px;
    max-width: calc(100% - 14px);
    padding: 4px 7px;
    overflow: hidden;
    color: #fff;
    background: rgba(11, 54, 34, 0.84);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview-grid:not(.edit-showcase-thumbnails) .image-preview-item.is-primary {
    outline: 2px solid var(--chicken-green, #198754);
    outline-offset: -2px;
}

/* Accordion เฉพาะฟอร์มเพิ่มข้อมูลไก่: ฟิลด์เดิมยังอยู่ในฟอร์มเดียวกัน */
#add-chicken-form .accordion-section {
    padding: 0;
    overflow: visible;
    background: #ffffff;
    border: 1px solid #e5ebe7;
    border-radius: 16px;
}

#add-chicken-form .accordion-section + .accordion-section {
    margin-top: 12px;
    padding-top: 0;
}

#add-chicken-form .accordion-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    border-radius: 15px 15px 0 0;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    transition: background-color 160ms ease;
}

#add-chicken-form .accordion-toggle:hover,
#add-chicken-form .accordion-toggle:focus-visible {
    background: #f7faf8;
}

#add-chicken-form .accordion-toggle:focus-visible {
    outline: 3px solid rgba(53, 91, 70, 0.18);
    outline-offset: -3px;
}

#add-chicken-form .accordion-toggle > .section-heading-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green);
    border-radius: 12px;
    font-size: 18px;
}

#add-chicken-form .accordion-toggle > .section-heading-text {
    display: block;
    min-width: 0;
}

#add-chicken-form .accordion-toggle .accordion-chevron {
    justify-self: end;
    color: #718078;
    font-size: 16px;
    transition: transform 180ms ease, color 180ms ease;
}

#add-chicken-form .accordion-toggle[aria-expanded="true"] .accordion-chevron {
    color: var(--chicken-green);
    transform: rotate(180deg);
}

#add-chicken-form .accordion-content {
    padding: 0 16px 18px;
    border-radius: 0 0 15px 15px;
}

#add-chicken-form .accordion-content[hidden] {
    display: none !important;
}

#add-chicken-form .accordion-content > .chicken-form-grid {
    padding-top: 2px;
}

@media (max-width: 620px) {
    #add-chicken-form .accordion-toggle {
        grid-template-columns: 38px minmax(0, 1fr) 28px;
        gap: 9px;
        padding: 12px;
    }

    #add-chicken-form .accordion-toggle > .section-heading-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 16px;
    }

    #add-chicken-form .accordion-content {
        padding: 0 12px 14px;
    }
}
/* ทำให้ชื่อหัวข้อ Accordion อยู่บรรทัดเดียว */
#add-chicken-form .accordion-toggle > .section-heading-text {
    width: 100%;
    min-width: 0;
}

#add-chicken-form .accordion-toggle .section-heading-text h3 {
    width: auto;
    max-width: none;
    margin: 0;

    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;

    font-size: 16px;
    line-height: 1.4;
}
/* =====================================================
   01. PAGE LAYOUT
   ใช้สี ฟอนต์ และระยะห่างจาก Dashboard Shared Layout
   ===================================================== */
.chickens-page {
    --chicken-green: #355b46;
    --chicken-green-dark: #1d3d2c;
    --chicken-green-soft: #edf4ef;
    --chicken-gold: #edebe5;
    --chicken-gold-soft: #fff8e8;
    --chicken-red: #b42318;
    --chicken-red-soft: #fff0ee;
    --chicken-orange: #b45309;
    --chicken-orange-soft: #fff7e6;
}

/* Edit mode reuses the same visual hierarchy as the chicken detail showcase. */
#chicken-modal .chicken-modal-dialog.is-edit-showcase {
    width: min(1180px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    background: #f5f6f2;
}

#chicken-modal .detail-showcase-edit:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.52fr);
    gap: 18px;
    padding: 18px;
    overflow: auto;
    align-items: start;
}

#chicken-modal .detail-showcase-edit[hidden] {
    display: none !important;
}

.detail-showcase-edit .edit-showcase-card {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid #e7e9e4;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(24, 39, 31, 0.04);
}

.detail-showcase-edit .edit-showcase-media {
    grid-column: 1;
    grid-row: 1;
}

.detail-showcase-edit .edit-showcase-fight {
    grid-column: 1;
    grid-row: 2;
}

.detail-showcase-edit .edit-showcase-overview {
    grid-column: 2;
    grid-row: 1;
}

.detail-showcase-edit .edit-showcase-lineage {
    grid-column: 2;
    grid-row: 2;
}

.detail-showcase-edit .edit-showcase-health {
    grid-column: 2;
    grid-row: 3;
}

.detail-showcase-edit .edit-form-actions {
    position: sticky;
    bottom: -18px;
    z-index: 12;
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 -18px -18px;
    padding: 14px 18px;
    border-top: 1px solid #e3e7e1;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 24px rgba(23, 41, 31, 0.08);
    backdrop-filter: blur(8px);
}

.detail-showcase-edit .edit-showcase-section-heading {
    padding-bottom: 2px;
}

.detail-showcase-edit .edit-showcase-section-heading h3 {
    margin: 2px 0 0;
    color: #17221b;
    font-size: 1.35rem;
}

.detail-showcase-edit .showcase-kicker {
    color: #f26422;
    font-size: 0.78rem;
    font-weight: 800;
}

.detail-showcase-edit .edit-form-grid {
    gap: 14px;
}

.detail-showcase-edit .edit-form-field label {
    color: #566159;
    font-size: 0.78rem;
    font-weight: 700;
}

.detail-showcase-edit .edit-form-field input,
.detail-showcase-edit .edit-form-field select,
.detail-showcase-edit .edit-form-field textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #dfe5df;
    border-radius: 9px;
    background: #f8faf8;
    color: #17221b;
}

.detail-showcase-edit .edit-form-field input:focus,
.detail-showcase-edit .edit-form-field select:focus,
.detail-showcase-edit .edit-form-field textarea:focus {
    border-color: #f26422;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(242, 100, 34, 0.12);
    outline: none;
}

.detail-showcase-edit .edit-form-field input[readonly] {
    color: #647069;
    background: #eef2ee;
    cursor: not-allowed;
}

.detail-showcase-edit .edit-main-image-preview {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    margin: 10px 0 12px;
    border-radius: 12px;
    background: #e8ece8;
}

.detail-showcase-edit .edit-main-image-preview > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-showcase-edit .edit-main-image-preview > span {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 6px 9px;
    border-radius: 999px;
    color: #fff;
    background: rgba(11, 54, 34, 0.88);
    font-size: 0.75rem;
    font-weight: 800;
}

.detail-showcase-edit .edit-showcase-thumbnails {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.detail-showcase-edit .edit-thumbnail-item {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    background: #f5f7f5;
}

.detail-showcase-edit .edit-thumbnail-item.is-primary {
    border-color: #f26422;
}

.detail-showcase-edit .edit-thumbnail-item > img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.detail-showcase-edit .edit-preview-state {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 3px 6px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 65, 41, 0.82);
    font-size: 0.65rem;
    font-weight: 700;
}

.detail-showcase-edit .edit-thumbnail-actions {
    display: grid;
    gap: 5px;
    padding: 7px;
}

.detail-showcase-edit .edit-thumbnail-actions button,
.detail-showcase-edit .edit-media-danger-button {
    min-height: 32px;
    border: 0;
    border-radius: 7px;
    color: #165333;
    background: #e4f2e9;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.detail-showcase-edit .edit-thumbnail-actions button:disabled {
    opacity: 0.55;
    cursor: default;
}

.detail-showcase-edit .edit-thumbnail-actions .is-danger,
.detail-showcase-edit .edit-media-danger-button {
    color: #a23a2c;
    background: #fdebe7;
}

.detail-showcase-edit .edit-video-preview video {
    width: 100%;
    max-height: 230px;
    margin-top: 10px;
    border-radius: 10px;
    background: #18231d;
}

.detail-showcase-edit .edit-video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 8px;
    font-size: 0.78rem;
}

.detail-showcase-edit .edit-media-empty {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 110px;
    color: #758077;
    background: #eef2ee;
}

.detail-showcase-edit .edit-readonly-history {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.detail-showcase-edit .edit-readonly-history details {
    overflow: hidden;
    border: 1px solid #e5e9e4;
    border-radius: 10px;
    background: #fafbfa;
}

.detail-showcase-edit .edit-readonly-history summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: #214b35;
    font-weight: 800;
    cursor: pointer;
}

.detail-showcase-edit .edit-readonly-history summary span {
    margin-left: auto;
    color: #7a857e;
    font-size: 0.7rem;
    font-weight: 600;
}

.detail-showcase-edit .edit-readonly-history .history-list,
.detail-showcase-edit .edit-readonly-history .detail-empty-value {
    padding: 0 12px 12px;
}

@media (max-width: 900px) {
    #chicken-modal .detail-showcase-edit:not([hidden]) {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
    }

    .detail-showcase-edit .edit-showcase-media,
    .detail-showcase-edit .edit-showcase-overview,
    .detail-showcase-edit .edit-showcase-lineage,
    .detail-showcase-edit .edit-showcase-health,
    .detail-showcase-edit .edit-showcase-fight {
        grid-column: 1;
        grid-row: auto;
    }

    .detail-showcase-edit .edit-showcase-media { order: 1; }
    .detail-showcase-edit .edit-showcase-overview { order: 2; }
    .detail-showcase-edit .edit-showcase-lineage { order: 3; }
    .detail-showcase-edit .edit-showcase-health { order: 4; }
    .detail-showcase-edit .edit-showcase-fight { order: 5; }
    .detail-showcase-edit .edit-form-actions { order: 6; margin: 0 -12px -12px; bottom: -12px; }
}

@media (max-width: 560px) {
    #chicken-modal .chicken-modal-dialog.is-edit-showcase {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }

    .detail-showcase-edit .edit-showcase-card {
        padding: 14px;
    }

    .detail-showcase-edit .edit-form-grid,
    .detail-showcase-edit .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-showcase-edit .edit-form-field,
    .detail-showcase-edit .edit-form-full {
        grid-column: 1;
    }

    .detail-showcase-edit .edit-form-actions {
        display: grid;
        grid-template-columns: 1fr 1.35fr;
    }
}

/* ========================================================================== 
   Edit chicken modal — restored from the S1 previous version.
   This block is intentionally limited to #chicken-edit-form; the detail
   popup and the current health modals remain on their current styles.
   ========================================================================== */
#chicken-modal #chicken-modal-dialog.modal-size-large:has(#chicken-edit-form:not([hidden])) {
    width: min(1180px, calc(100vw - 40px)) !important;
    max-width: 1180px !important;
    max-height: calc(100dvh - 40px) !important;
    background: #f5f6f2 !important;
}

#chicken-modal #chicken-edit-form.detail-showcase-edit:not([hidden]) {
    display: grid !important;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.52fr) !important;
    grid-template-areas:
        "media info"
        "fight info"
        "actions actions" !important;
    gap: 18px !important;
    align-items: start !important;
    padding: 18px !important;
    overflow: auto !important;
    background: #f5f6f2 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group {
    grid-area: info !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    align-self: start !important;
    border: 1px solid #e4e9e5 !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 8px 24px rgba(23, 69, 42, 0.05) !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card,
#chicken-modal #chicken-edit-form .edit-showcase-card {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 18px !important;
    border: 1px solid #e4e9e5 !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 8px 24px rgba(23, 69, 42, 0.05) !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:first-child {
    border-radius: 18px 18px 0 0 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:last-child {
    border-radius: 0 0 18px 18px !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card + .edit-showcase-card {
    border-top: 1px solid #e7ece8 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-media {
    grid-area: media !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-fight {
    grid-area: fight !important;
}

#chicken-modal #chicken-edit-form .edit-form-actions {
    position: sticky !important;
    bottom: -18px !important;
    z-index: 12 !important;
    grid-area: actions !important;
    width: auto !important;
    margin: 0 -18px -18px !important;
    padding: 14px 18px !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid #e3e7e1 !important;
    box-shadow: 0 -8px 24px rgba(23, 41, 31, 0.08) !important;
    backdrop-filter: blur(8px) !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-section-heading {
    padding-bottom: 2px !important;
    margin-bottom: 16px !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-section-heading h3 {
    margin: 2px 0 0 !important;
    color: #17221b !important;
    font-size: 1.35rem !important;
}

#chicken-modal #chicken-edit-form .showcase-kicker {
    color: #f26422 !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
}

#chicken-modal #chicken-edit-form .edit-form-grid {
    gap: 14px !important;
}

#chicken-modal #chicken-edit-form .edit-form-field label {
    color: #566159 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea) {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    border: 1px solid #dfe5df !important;
    border-radius: 9px !important;
    background: #f8faf8 !important;
    color: #17221b !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea):focus {
    border-color: #f26422 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(242, 100, 34, 0.12) !important;
    outline: none !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea)[readonly] {
    color: #647069 !important;
    background: #eef2ee !important;
    cursor: not-allowed !important;
}

#chicken-modal #chicken-edit-form .edit-main-image-preview {
    aspect-ratio: 4 / 3 !important;
    min-height: 0 !important;
    margin: 10px 0 12px !important;
    border-radius: 12px !important;
    background: #e8ece8 !important;
}

#chicken-modal #chicken-edit-form .edit-main-image-preview > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-thumbnails {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
}

#chicken-modal #chicken-edit-form .edit-readonly-history {
    display: grid !important;
    gap: 8px !important;
    margin-top: 14px !important;
}

#chicken-modal #chicken-edit-form .edit-readonly-history details {
    overflow: hidden !important;
    border: 1px solid #e5e9e4 !important;
    border-radius: 10px !important;
    background: #fafbfa !important;
}

@media (max-width: 900px) {
    #chicken-modal #chicken-edit-form.detail-showcase-edit:not([hidden]) {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-areas: "media" "info" "fight" "actions" !important;
        padding: 12px !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-media,
    #chicken-modal #chicken-edit-form .edit-showcase-overview,
    #chicken-modal #chicken-edit-form .edit-showcase-lineage,
    #chicken-modal #chicken-edit-form .edit-showcase-health,
    #chicken-modal #chicken-edit-form .edit-showcase-fight {
        grid-column: 1 !important;
        grid-row: auto !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-media { order: 1 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-overview { order: 2 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-lineage { order: 3 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-health { order: 4 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-fight { order: 5 !important; }
    #chicken-modal #chicken-edit-form .edit-form-actions { order: 6 !important; margin: 0 -12px -12px !important; bottom: -12px !important; }
}

@media (max-width: 560px) {
    #chicken-modal #chicken-modal-dialog.modal-size-large:has(#chicken-edit-form:not([hidden])) {
        width: 100vw !important;
        max-width: none !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-card {
        padding: 14px !important;
    }

    #chicken-modal #chicken-edit-form .edit-form-grid,
    #chicken-modal #chicken-edit-form .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #chicken-modal #chicken-edit-form .edit-form-field,
    #chicken-modal #chicken-edit-form .edit-form-full {
        grid-column: 1 !important;
    }

    #chicken-modal #chicken-edit-form .edit-form-actions {
        display: grid !important;
        grid-template-columns: 1fr 1.35fr !important;
    }
}

/* ========================================================================== 
   Current health modal family — one shared shell, current content/logic kept.
   ========================================================================== */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium:has(.health-modal-form:not([hidden]), .health-modal-content:not([hidden])) {
    width: min(720px, calc(100vw - 40px)) !important;
    max-width: 720px !important;
    max-height: min(88dvh, 760px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 20px 52px rgba(23, 41, 31, 0.16) !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .chicken-modal-header {
    flex: 0 0 auto !important;
    min-height: 72px !important;
    padding: 16px 22px !important;
    border-bottom: 1px solid #e3e9e5 !important;
    background: #fff !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .modal-header-title {
    min-width: 0 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .modal-header-title #chicken-modal-title {
    color: #172019 !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .modal-close-button {
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form:not([hidden]),
#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-content:not([hidden]) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form:not([hidden]) {
    display: flex !important;
    flex-direction: column !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .chicken-form-section,
#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-content:not([hidden]) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 20px 24px 24px !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-section-heading {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 0 0 16px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-section-heading > span {
    flex: 0 0 32px !important;
    width: 32px !important;
    height: 32px !important;
    display: grid !important;
    place-items: center !important;
    border-radius: 8px !important;
    background: #eef4f0 !important;
    color: #355b46 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-section-heading h3 {
    margin: 0 !important;
    color: #172019 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-section-heading p {
    margin: 3px 0 0 !important;
    color: #66736c !important;
    font-size: .78rem !important;
    line-height: 1.5 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 16px !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field {
    min-width: 0 !important;
    display: grid !important;
    gap: 7px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .form-field-full {
    grid-column: 1 / -1 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field > label {
    color: #29332d !important;
    font-size: .82rem !important;
    font-weight: 600 !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field :is(input:not([type="file"]), select, textarea) {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #172019 !important;
    font: inherit !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field :is(input:not([type="file"]), select) {
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 12px !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field textarea {
    min-height: 96px !important;
    padding: 10px 12px !important;
    line-height: 1.5 !important;
    resize: vertical !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field :is(input, select, textarea):focus {
    border-color: #355b46 !important;
    box-shadow: 0 0 0 3px rgba(53, 91, 70, .12) !important;
    outline: none !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .edit-form-actions {
    position: static !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 14px 24px !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    border-top: 1px solid #e3e9e5 !important;
    background: #fff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .edit-form-actions :is(.modal-cancel-button, .modal-save-button) {
    min-width: 112px !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
}

@media (max-width: 640px) {
    #chicken-modal #chicken-modal-dialog.modal-size-medium {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 12px !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .chicken-modal-header {
        padding: 14px 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .chicken-form-section,
    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-content:not([hidden]) {
        padding: 16px 18px 20px !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .form-field-full {
        grid-column: 1 !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .edit-form-actions {
        padding: 12px 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form > .edit-form-actions :is(.modal-cancel-button, .modal-save-button) {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }
}

.chicken-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1 1 auto;
    gap: 20px;
    min-width: 0;
}

.topbar-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-heading p {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 13px;
}

.chicken-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 12px;
}

.add-chicken-button {
    min-height: 46px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    color: #ffffff;
    background:  #17653D;
    border: 1px solid rgba(254, 254, 254, 0.92);
    border-radius: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
    margin-right: 24px;
}


.add-chicken-button:hover {
    background: #102f20;
    border: 1px solid rgba(254, 254, 254, 0.92);
    transform: translateY(-1px);
}

.add-chicken-button:active {
    transform: translateY(0) scale(0.98);
}

.add-chicken-button:focus-visible {
    outline: 3px solid rgba(178, 138, 46, 0.25);
    outline-offset: 3px;
}

.mobile-sidebar-button {
    display: none;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    background: #ffffff;
    color: #111827;
    border: 0;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 22px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(3, 10, 6, 0.48);
    border: 0;
    opacity: 0;
    transition: opacity var(--motion-normal, 220ms) ease;
}

.sidebar-overlay.show {
    opacity: 1;
}

/* =====================================================
   02. SUMMARY CARDS
   การ์ดสรุปที่ใช้เป็นตัวกรองรายการด้านล่าง
   ===================================================== */
.chicken-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chicken-summary-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 138px;
    padding: 22px;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid transparent;
    border-radius: 28px;
    box-shadow: var(--shadow-md);
    text-align: left;
    cursor: pointer;
    transition:
        transform var(--motion-normal, 220ms) var(--motion-ease, ease),
        border-color var(--motion-normal, 220ms) ease,
        box-shadow var(--motion-normal, 220ms) ease,
        background-color var(--motion-normal, 220ms) ease;
}

.chicken-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.11);
}

.chicken-summary-card:active {
    transform: scale(0.98);
}

.chicken-summary-card:focus-visible {
    outline: 3px solid rgba(178, 138, 46, 0.25);
    outline-offset: 3px;
}

.chicken-summary-card.is-active {
    color: #ffffff;

    background: linear-gradient(
        145deg,
        #234b35,
        #356a4c
    );

border: 2px solid #e3e7e57b;
border-radius: 28px;

box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.08);
}

.summary-card-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    font-size: 30px;
}

.summary-card-content {
    display: block;
    min-width: 0;
}

.summary-card-label {
    display: block;
    margin-bottom: 8px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-card-content strong {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

.summary-card-content small {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.summary-card-arrow {
    justify-self: end;
    color: #9ca3af;
    font-size: 20px;
}

.chicken-summary-card.is-active .summary-card-arrow {
    color: var(--chicken-gold);
}

.list-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.list-section-heading h2 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0;
}

.list-section-heading p {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 15px;
}

.page-size-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 13px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* =====================================================
   04. SEARCH และ FILTER
   ช่องค้นหาและตัวกรองข้อมูลไก่
   ===================================================== */
.chicken-list-section {
    padding: 26px;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: var(--shadow-md);
}

.chicken-filter-panel {
    display: grid;
    grid-template-columns: minmax(200px, 1.6fr) repeat(5, minmax(100px, 1fr)) auto;
    align-items: end;
    gap: 11px;
    margin-bottom: 22px;
    padding: 16px;

    background: #ffffff;
    border: none;
    border-radius: 24px;
    box-shadow: none;
}

.filter-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.filter-field label {
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}

.filter-input-with-icon {
    position: relative;
}

.filter-input-with-icon i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: #84918a;
    transform: translateY(-50%);
    pointer-events: none;
    border-radius: 999px;
}

.filter-field input,
.filter-field select,
.filter-field .custom-dropdown-toggle {
    width: 100%;
    height: 44px;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #dde4df;
    border-radius: 13px;
    outline: none;
    font-size: 13px;
    transition:
        border-color var(--motion-fast, 140ms) ease,
        box-shadow var(--motion-fast, 140ms) ease,
        background-color var(--motion-fast, 140ms) ease;
}

.filter-field input {
    padding: 0 13px 0 40px;
}

.filter-field select,
.filter-field .custom-dropdown-toggle {
    padding: 0 34px 0 12px;
    cursor: pointer;
}

.filter-field input:focus,
.filter-field select:focus,
.filter-field .custom-dropdown-toggle:focus {
    background: #ffffff;
    border-color: var(--chicken-green);
    box-shadow: 0 0 0 3px rgba(53, 91, 70, 0.12);
}

.clear-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 16px;
    background: #ffffff;
    color: #4b5563;
    border: 1px solid #dde4df;
    border-radius: 13px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition:
        color var(--motion-fast, 140ms) ease,
        border-color var(--motion-fast, 140ms) ease,
        transform var(--motion-fast, 140ms) ease;
}

.clear-filter-button:hover {
    color: var(--chicken-green-dark);
    border-color: var(--chicken-green);
    transform: translateY(-1px);
}

.clear-filter-button:active {
    transform: scale(0.97);
}

/* =====================================================
   05. CHICKEN TABLE
   ตาราง Desktop และ Tablet
   ===================================================== */
.chicken-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    border-spacing: 0;
}

.chicken-table td {
    padding: 18px 13px;
    background: transparent;           /* เอาพื้นเทาออก */
    border-top: 1px solid #e5e7eb;     /* เส้นบน */
    border-bottom: 1px solid #e5e7eb;  /* เส้นล่าง */
    border-left: none;                 /* เอาขอบซ้ายออก */
    border-right: none;                /* เอาขอบขวาออก */
    border-radius: 0;                  /* เอามุมโค้งออก */
}

.chicken-table td:first-child,
.chicken-table td:last-child {
    border-left: none;
    border-right: none;
    border-radius: 0;
}
.chicken-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
}

.chicken-identity img {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 14px;
    background: #e8eeea;
}

.chicken-identity div {
    min-width: 0;
}

.chicken-identity strong,
.chicken-identity span {
    display: block;
}

.chicken-identity strong {
    max-width: 150px;
    overflow: hidden;
    color: #17231c;
    font-size: 20px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chicken-identity span {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 16px;
    letter-spacing: 0;
}

.health-healthy,
.vaccine-complete {
    background: #e9f7ee;
    color: #27603e;
}

.health-sick {
    background: var(--chicken-red-soft);
    color: var(--chicken-red);
}

.health-treatment {
    background: var(--chicken-orange-soft);
    color: var(--chicken-orange);
}

.vaccine-due {
    background: var(--chicken-orange-soft);
    color: var(--chicken-orange);
}

.vaccine-scheduled {
    background: #f2f4f3;
    color: #58645e;
}

.type-father {
    background: #F7D794;
    color: #111827;
}

.type-mother {
    background: #F7D794;
    color: #111827;
}

.type-general {
    background: #f2f4f3;
    color: #58645e;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.row-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #000000;
    color: #000000;
}

.row-action-button:hover {
    transform: translateY(-1px);
}

.row-action-button:active {
    transform: scale(0.96);
}

.detail-action-button {
    background: #6B7280;
    color: #ffffff;
}

.detail-action-button:hover {
    background: #ffffff;
    color: #171b18;
    border-color: #171b18;
}

.edit-action-button {
    background: #171b18;
    color: #ffffff;
    border: 1px solid #171b18;
}

.edit-action-button:hover {
    background: var(--chicken-green-dark);
    border-color: var(--chicken-green-dark);
}

/* =====================================================
   06. EMPTY STATE และ PAGINATION
   ===================================================== */
.chicken-empty-state {
    padding: 56px 20px;
    text-align: center;
}

.chicken-empty-state > span {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green);
    border-radius: 50%;
    font-size: 25px;
}

.chicken-empty-state h3 {
    font-size: 19px;
    font-weight: 600;
}

.chicken-empty-state p {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.chicken-empty-state button {
    min-height: 40px;
    margin-top: 18px;
    padding: 0 16px;
    background: #171b18;
    color: #ffffff;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.chicken-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 24px;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 7px;
}

.chicken-pagination button,
.pagination-dots {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background: #ffffff;
    color: #4b5563;
    border: 1px solid #dfe5e1;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
}

.chicken-pagination button {
    cursor: pointer;
    transition:
        transform var(--motion-fast, 140ms) ease,
        color var(--motion-fast, 140ms) ease,
        background-color var(--motion-fast, 140ms) ease,
        border-color var(--motion-fast, 140ms) ease;
}

.chicken-pagination button:hover:not(:disabled) {
    color: var(--chicken-green-dark);
    border-color: var(--chicken-green);
    transform: translateY(-1px);
}

.chicken-pagination button:active:not(:disabled) {
    transform: scale(0.95);
}

.chicken-pagination button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.pagination-page.is-current {
    background: var(--chicken-green-dark);
    color: #ffffff;
    border-color: var(--chicken-green-dark);
    box-shadow: 0 8px 18px rgba(29, 61, 44, 0.20);
}

.pagination-dots {
    border-color: transparent;
    background: transparent;
}

/* =====================================================
   07. DETAIL และ EDIT MODAL
   ===================================================== */
.modal-open {
    overflow: hidden;
}

.chicken-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 20px;
}

.chicken-modal-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 12, 7, 0.62);
    border: 0;
    opacity: 0;
    cursor: default;
    transition: opacity var(--motion-normal, 220ms) ease;
}

.chicken-modal-dialog {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    position: relative;
    z-index: 1;
    max-width: 1500px;
    max-height: 94vh;
    
    padding: 32px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition:
        opacity var(--motion-normal, 220ms) ease,
        transform var(--motion-normal, 220ms) var(--motion-ease, ease);
}

.chicken-modal-dialog::-webkit-scrollbar {
    width: 10px;
}

.chicken-modal-dialog::-webkit-scrollbar-track {
    background: #f3f5f4;
    border-radius: 999px;
}

.chicken-modal-dialog::-webkit-scrollbar-thumb {
    background: #aab3ad;
    border: 2px solid #f3f5f4;
    border-radius: 999px;
}

.chicken-modal-dialog::-webkit-scrollbar-thumb:hover {
    background: #355b46;
}

.chicken-modal-dialog.is-form-wide {
    width: min(920px, 100%);
}

.chicken-modal.show .chicken-modal-backdrop,
.chicken-modal.show .chicken-modal-dialog {
    opacity: 1;
}

.chicken-modal.show .chicken-modal-dialog {
    transform: translateY(0) scale(1);
}

.chicken-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid #edf1ee;
}

.modal-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--chicken-green);
    font-size: 14px;
    font-weight: 600;
}

.chicken-modal-header h2 {
    font-size: 23px;
    font-weight: 600;
}
.chicken-modal h2 {
    font-size: 23px;
    font-weight: 600;
}

.modal-close-button {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: #f2f4f3;
    color: #111827;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition:
        color var(--motion-fast, 140ms) ease,
        background-color var(--motion-fast, 140ms) ease,
        transform var(--motion-fast, 140ms) ease;
}

.modal-close-button:hover {
    background: #171b18;
    color: #ffffff;
}

.modal-close-button:active {
    transform: scale(0.94);
}

.chicken-detail-view {
    padding-top: 20px;
}

.detail-modal-hero {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8faf9;
    border: 1px solid #edf1ee;
    border-radius: 18px;
}

.detail-main-image-link {
    position: relative;
    display: block;
    width: 180px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #e8eeea;
    border-radius: 15px;
}

.detail-main-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--motion-normal, 220ms) ease;
}

.detail-main-image-link > span,
.detail-media-item > span {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    background: rgba(18, 43, 29, 0.86);
    color: #ffffff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--motion-fast, 140ms) ease;
}

.detail-main-image-link:hover img,
.detail-media-item:hover img {
    transform: scale(1.04);
}

.detail-main-image-link:hover > span,
.detail-media-item:hover > span {
    opacity: 1;
}

.detail-modal-hero-copy > span {
    color: var(--text-secondary);
    font-size: 12px;
}

.detail-modal-hero-copy h3 {
    margin-top: 4px;
    font-size: 24px;
    font-weight: 600;
}

.detail-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.detail-section {
    margin-top: 18px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #edf1ee;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(23, 35, 28, 0.04);
}

.detail-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-section-heading > span {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green);
    border-radius: 12px;
    font-size: 18px;
}

.detail-section-heading h3 {
    color: #1e2923;
    font-size: 16px;
    font-weight: 600;
}

.detail-section-heading p {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-lineage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-info-item {
    min-width: 0;
    padding: 14px;
    background: #fafcfb;
    border: 1px solid #f0f3f1;
    border-radius: 12px;
}

.detail-info-wide {
    grid-column: 1 / -1;
}

.detail-info-item span,
.detail-info-item strong {
    display: block;
}

.detail-info-item span {
    color: var(--text-secondary);
    font-size: 11px;
}

.detail-info-item strong {
    margin-top: 5px;
    color: #27332c;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.detail-empty-value {
    color: #8a958e !important;
    font-weight: 400 !important;
}

.detail-fight-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-fight-summary > div {
    padding: 16px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green-dark);
    border-radius: 13px;
    text-align: center;
}

.detail-fight-summary span,
.detail-fight-summary strong {
    display: block;
}

.detail-fight-summary span {
    font-size: 11px;
}

.detail-fight-summary strong {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.detail-fight-info {
    margin-top: 12px;
}

.detail-media-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-media-item {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #e8eeea;
    border: 2px solid transparent;
    border-radius: 13px;
    cursor: pointer;
}

.detail-media-item.is-active {
    border-color: #1d3d2c;
    box-shadow: 0 0 0 3px rgba(29, 61, 44, 0.12);
}

.detail-media-item > span {
    width: auto;
    height: auto;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 10px;
    opacity: 1;
}

.detail-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--motion-normal, 220ms) ease;
}

.detail-video-container {
    margin-top: 14px;
    overflow: hidden;
    background: #f8faf9;
    border: 1px solid #edf1ee;
    border-radius: 14px;
}

.detail-video-container video {
    display: block;
    width: 100%;
    max-height: 420px;
    background: #111712;
}

.detail-video-container > p {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: #3f4d45;
    font-size: 12px;
}

.detail-media-empty {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 120px;
    padding: 20px;
    color: #849087;
    text-align: center;
}

.detail-media-empty i {
    font-size: 28px;
}

.detail-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #edf1ee;
}

.detail-edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    background: #1d3d2c;
    color: #ffffff;
    border: 1px solid #1d3d2c;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(29, 61, 44, 0.18);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition:
        background-color var(--motion-fast, 140ms) ease,
        transform var(--motion-fast, 140ms) ease;
}

.detail-edit-button:hover {
    background: #122b1d;
    transform: translateY(-2px);
}

.detail-edit-button:active {
    transform: scale(0.98);
}

.chicken-edit-form,
.chicken-entry-form,
.chicken-vaccine-form {
    padding-top: 20px;
}

.edit-form-grid,
.chicken-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.edit-form-field,
.chicken-form-field {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
}

.edit-form-full,
.form-field-full {
    grid-column: 1 / -1;
}

.edit-form-field label,
.chicken-form-field label {
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

.chicken-form-field label span {
    color: var(--chicken-red);
}

.edit-form-field input,
.edit-form-field select,
.edit-form-field textarea,
.chicken-form-field input,
.chicken-form-field select,
.edit-form-field textarea,
.chicken-form-field textarea {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    background: #f9fbfa;
    color: #1f2937;
    border: 1px solid #dfe5e1;
    border-radius: 12px;
    outline: none;
    font-size: 13px;
    transition:
        border-color var(--motion-fast, 140ms) ease,
        background-color var(--motion-fast, 140ms) ease,
        box-shadow var(--motion-fast, 140ms) ease;
}

.chicken-form-field textarea {
    height: auto;
    min-height: 92px;
    padding: 11px 12px;
    resize: vertical;
}

.chicken-form-field input[readonly] {
    background: #f0f3f1;
    color: #66736b;
    cursor: not-allowed;
}

.chicken-form-field input:disabled,
.chicken-form-field select:disabled,
.edit-form-field input:disabled,
.edit-form-field select:disabled {
    color: #7b857f;
    background: #f0f3f1;
    cursor: not-allowed;
    opacity: 1;
}

.edit-form-field input:focus,
.edit-form-field select:focus,
.edit-form-field textarea:focus,
.chicken-form-field input:focus,
.chicken-form-field select:focus,
.chicken-form-field textarea:focus {
    background: #ffffff;
    border-color: var(--chicken-green);
    box-shadow: 0 0 0 3px rgba(53, 91, 70, 0.12);
}

.chicken-form-field input.invalid,
.chicken-form-field select.invalid,
.chicken-form-field textarea.invalid {
    background: #fffafa;
    border-color: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.08);
}

.edit-form-field input.invalid,
.edit-form-field select.invalid,
.edit-form-field textarea.invalid {
    background: #fffafa;
    border-color: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.08);
}

.form-hint {
    color: #7a857f;
    font-size: 11px;
    line-height: 1.5;
}

.form-error {
    display: block;
    color: #b42318;
    font-size: 11px;
    line-height: 1.45;
}

.form-error:empty {
    display: none;
}

.chicken-form-section {
    padding: 6px 0 26px;
}

.edit-form-section {
    margin-top: 26px;
}

.chicken-form-section + .chicken-form-section {
    padding-top: 26px;
}

.chicken-form-section:last-of-type {
    border-bottom: 0;
}

.chicken-form-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.chicken-form-section-heading > span {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green);
    border-radius: 12px;
    font-size: 18px;
}

.chicken-form-section-heading h3 {
    color: #1e2923;
    font-size: 16px;
    font-weight: 600;
}

.chicken-form-section-heading p {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.fight-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.media-upload-field input[type="file"] {
    height: auto;
    min-height: 48px;
    padding: 6px;
    background: #f9fbfa;
    cursor: pointer;
}

.media-upload-field input[type="file"]::file-selector-button {
    min-height: 34px;
    margin-right: 10px;
    padding: 0 13px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green-dark);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.image-preview-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #edf1ee;
    border-radius: 12px;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview-button {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: rgba(19, 28, 23, 0.86);
    color: #ffffff;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

.remove-preview-button:hover {
    background: #a41f18;
}

.video-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 12px;
    background: var(--chicken-green-soft);
    color: var(--chicken-green-dark);
    border-radius: 11px;
    font-size: 12px;
}

.video-preview i {
    flex: 0 0 auto;
    font-size: 19px;
}

.video-preview span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-video-button {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    background: transparent;
    color: var(--chicken-green-dark);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.remove-video-button:hover {
    background: rgba(29, 61, 44, 0.10);
}

.sticky-form-actions {
    position: sticky;
    bottom: -24px;
    z-index: 2;
    margin-right: -24px;
    margin-left: -24px;
    padding: 18px 24px 24px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}

.edit-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #edf1ee;
}

.modal-cancel-button,
.modal-save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 17px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.modal-cancel-button {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-save-button {
    background: #1d3d2c;
    color: #ffffff;
    border: 1px solid #1d3d2c;
}

.chicken-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 400;
    max-width: min(360px, calc(100vw - 28px));
    padding: 12px 16px;
    background: #17231c;
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.20);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    font-size: 12px;
    transition:
        opacity var(--motion-normal, 220ms) ease,
        visibility var(--motion-normal, 220ms) ease,
        transform var(--motion-normal, 220ms) var(--motion-ease, ease);
}

.chicken-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =====================================================
   08. RESPONSIVE
   Desktop, Tablet และ Mobile
   ===================================================== */
@media (max-width: 1280px) {
    .chicken-page-header {
        flex-wrap: wrap;
    }

    .chicken-header-actions {
        margin-left: auto;
    }

    .chicken-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chicken-filter-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-search-field {
        grid-column: span 2;
    }

    .clear-filter-button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .mobile-sidebar-button {
        display: grid;
    }

    .sidebar {
        width: min(290px, calc(100vw - 56px));
    }

    .dashboard-topbar {
        align-items: center;
        flex-direction: row;
    }

    .topbar-actions {
        width: auto;

    }
}

@media (max-width: 768px) {
    .dashboard-topbar {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .chicken-page-header {
        width: 100%;
    }

    .fight-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-info-grid,
    .detail-media-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chicken-list-section {
        padding: 20px;
    }

    .chicken-filter-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-search-field {
        grid-column: 1 / -1;
    }

    .clear-filter-button {
        align-self: end;
    }

    .chicken-table-shell {
        overflow: visible;
    }

    .chicken-table {
        min-width: 0;
        border-spacing: 0;
    }

    .chicken-table thead {
        display: none;
    }

    .chicken-table tbody {
        display: grid;
        gap: 14px;
    }

    .chicken-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 16px;
        background: #ffffff;
        border: 1px solid #e5ebe7;
        border-radius: 18px;
        box-shadow: var(--shadow-sm);
    }

    .chicken-table tbody tr:hover {
        transform: none;
    }

    .chicken-table td,
    .chicken-table td:first-child,
    .chicken-table td:last-child {
        display: flex;
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        min-width: 0;
        padding: 18px;
        background: transparent;
        border: 0;
        border-radius: 0;
        white-space: normal;
    }

    .chicken-table td::before {
        content: attr(data-label);
        color: #7a877f;
        font-size: 14px;
        font-weight: 600;
    }

    .chicken-table td.chicken-name-cell,
    .chicken-table td.action-cell {
        grid-column: 1 / -1;
    }

    .chicken-table td.chicken-name-cell {
        padding-bottom: 14px;
        border-bottom: 1px solid #edf1ee;
    }

    .chicken-table td.chicken-name-cell::before,
    .chicken-table td.action-cell::before {
        display: none;
    }

    .chicken-identity {
        min-width: 0;
        width: 100%;
    }

    .chicken-identity strong {
        max-width: calc(100vw - 170px);
    }

    .row-actions {
        width: 100%;
        padding-top: 6px;
    }

    .row-action-button {
        flex: 1;
    }

    .chicken-list-section {
        background: transparent;
        box-shadow: none;
    }

    .list-section-heading,
    .chicken-filter-panel {
        padding: 18px;
        background: #ffffff;
        border-radius: 20px;
        box-shadow: var(--shadow-sm);
    }

    .list-section-heading {
        margin-bottom: 14px;
    }

    .chicken-filter-panel {
        margin-bottom: 16px;
    }
}

@media (max-width: 620px) {
    .chicken-page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .chicken-header-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
    }

    .add-chicken-button {
        width: 100%;
    }

    .chicken-summary-grid {
        grid-template-columns: 1fr;
    }

    .chicken-summary-card {
        min-height: 112px;
    }

    .list-section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-size-label {
        align-self: flex-start;
    }

    .chicken-filter-panel {
        grid-template-columns: 1fr;
    }

    .filter-search-field {
        grid-column: auto;
    }

    .detail-modal-hero {
        grid-template-columns: 1fr;
    }

    .detail-main-image-link {
        width: 100%;
    }

    .detail-info-grid,
    .detail-lineage-grid,
    .detail-fight-summary,
    .detail-media-gallery,
    .edit-form-grid,
    .chicken-form-grid,
    .fight-stat-grid {
        grid-template-columns: 1fr;
    }

    .detail-info-wide,
    .edit-form-full,
    .form-field-full {
        grid-column: auto;
    }

    .image-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =====================================================
   DETAIL POPUP SHOWCASE
   รูปแบบสองคอลัมน์ตามหน้ารายละเอียดไก่ตัวอย่าง
   ===================================================== */
.chicken-modal-dialog.is-detail-showcase {
    width: min(1120px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 18px;
    background: #f3f4ef;
    border-radius: 24px;
}

.is-detail-showcase .chicken-modal-header {
    position: absolute;
    top: 26px;
    right: 26px;
    z-index: 8;
    padding: 0;
    border: 0;
}

.is-detail-showcase .chicken-modal-header > div {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.is-detail-showcase .modal-close-button {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 18px rgba(21, 35, 27, 0.12);
}

.is-detail-showcase .chicken-detail-view {
    padding: 0;
}

.detail-showcase-layout {
    grid-template-columns: minmax(540px, 100%) minmax(0, 1fr);
    gap: 24px;
}

.showcase-main-image {
    aspect-ratio: 1 / 1;
}

.showcase-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.showcase-sale-label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    min-height: 38px;
    padding: 10px 18px;
    background: #123d29;
    color: #ffffff;
    border-radius: 18px 0 14px 0;
    font-size: 12px;
    font-weight: 700;
}

.showcase-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.showcase-thumbnail {
    overflow: hidden;
    aspect-ratio: 1;
    padding: 0;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.showcase-thumbnail:hover,
.showcase-thumbnail.is-active {
    border-color: #f26522;
    transform: translateY(-2px);
}

.showcase-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.showcase-farm-card,
.showcase-media-card,
.showcase-overview-card,
.showcase-history-card {
    background: #ffffff;
    border: 1px solid #e9ece7;
    border-radius: 18px;
    box-shadow: 0 6px 18px rgba(35, 48, 40, 0.04);
}

.showcase-farm-card,
.showcase-media-card {
    padding: 16px;
}

.showcase-farm-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.showcase-farm-heading > span {
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    height: 42px;
    background: #063d28;
    color: #ffffff;
    border-radius: 12px;
}

.showcase-farm-heading strong,
.showcase-farm-heading small {
    display: block;
}

.showcase-farm-heading strong {
    color: #25312a;
    font-size: 14px;
}

.showcase-farm-heading small {
    margin-top: 4px;
    color: #7b867f;
    font-size: 11px;
}

.showcase-farm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.showcase-farm-actions button {
    min-height: 38px;
    background: #ffffff;
    color: #f26522;
    border: 1px solid #f26522;
    border-radius: 999px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
}

.showcase-farm-actions button:last-child {
    background: #f26522;
    color: #ffffff;
}

.showcase-record-card {
    position: relative;
    display: grid;
    gap: 5px;
    padding: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, #06472e, #0e3828);
    color: #ffffff;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(4, 61, 39, 0.18);
}

.showcase-record-card::after {
    content: "\F5B3";
    position: absolute;
    right: 14px;
    bottom: -10px;
    color: rgba(255, 255, 255, 0.08);
    font-family: "bootstrap-icons";
    font-size: 76px;
}

.showcase-record-card > span,
.showcase-record-card > small {
    color: #a8d4bf;
    font-size: 11px;
}

.showcase-record-card > strong {
    font-size: 22px;
}

.showcase-record-card > small {
    display: flex;
    justify-content: space-between;
}

.showcase-record-card b {
    color: #ffffff;
}

.showcase-media-card h3 {
    color: #2b352f;
    font-size: 14px;
}

.showcase-media-card h3 i,
.showcase-section-title i {
    color: #f26522;
}

.showcase-media-card video,
.showcase-video-placeholder {
    width: 100%;
    margin-top: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: linear-gradient(145deg, #263a47, #59727c);
    border-radius: 13px;
}

.showcase-media-card video {
    display: block;
}

.showcase-video-placeholder {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: #ffffff;
}

.showcase-video-placeholder i {
    color: #f26522;
    font-size: 40px;
}

.showcase-video-placeholder span,
.showcase-media-card p,
.showcase-fight-copy {
    font-size: 11px;
}

.showcase-fight-copy {
    margin-top: 10px;
    color: #6d7971;
    line-height: 1.55;
}

.showcase-overview-card {
    padding: 26px;
}

.showcase-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-right: 42px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eef0ec;
}

.showcase-title-row > div > span {
    color: #f26522;
    font-size: 11px;
    font-weight: 700;
}

.showcase-title-row h2 {
    margin-top: 3px;
    color: #202a24;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.25;
}

.is-detail-showcase .data-badge {
    min-height: 27px;
    padding: 0 10px;
    font-size: 10px;
}

.showcase-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 20px 0 12px;
    color: #344039;
    font-size: 13px;
    font-weight: 700;
}

.showcase-fact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.showcase-fact-grid > div,
.showcase-lineage-grid > div {
    padding: 13px;
    background: #f7f9fa;
    border-radius: 12px;
}

.showcase-fact-grid span,
.showcase-fact-grid strong,
.showcase-lineage-grid span,
.showcase-lineage-grid strong {
    display: block;
}

.showcase-fact-grid span,
.showcase-lineage-grid span,
.showcase-health-panel span,
.showcase-vaccine-panel span {
    color: #859087;
    font-size: 10px;
}

.showcase-fact-grid strong,
.showcase-lineage-grid strong {
    margin-top: 6px;
    color: #253129;
    font-size: 12px;
}

.showcase-lineage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.showcase-lineage-grid > div:nth-child(1),
.showcase-lineage-grid > div:nth-child(2) {
    background: #ffffff !important;
    border: none !important;
}

.showcase-lineage-grid > div:nth-child(3) {
    background: #f2f5f3;
    border: 1px solid #e1e7e3;
}

.showcase-health-panel,
.showcase-vaccine-panel {
    padding: 15px;
    background: #f7f9fa;
    border-radius: 13px;
}

.showcase-health-panel > div,
.showcase-vaccine-panel > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 38px;
    border-bottom: 1px solid #e9eeeb;
}

.showcase-health-panel > div:last-child,
.showcase-vaccine-panel > div:last-child {
    border-bottom: 0;
}

.showcase-health-panel strong,
.showcase-vaccine-panel strong {
    color: #37443c;
    font-size: 11px;
    text-align: right;
}

.showcase-vaccine-panel {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.showcase-vaccine-panel > div {
    display: grid;
    justify-content: start;
    border: 0;
}

.showcase-vaccine-panel strong {
    text-align: left;
}

.showcase-history-card {
    padding: 20px;
}

.showcase-history-divider {
    height: 1px;
    margin: 22px 0;
    background: #e8ede9;
}

.is-detail-showcase .showcase-history-card .history-list {
    grid-template-columns: 1fr;
}

.showcase-detail-actions {
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
    width: min(210px, 100%);
    margin: 0;
    padding: 0;
    border: 0;
}

.lineage-action-button,
.showcase-detail-actions .detail-edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 0 18px;
    background: #f26522;
    color: #ffffff;
    border: 1px solid #f26522;
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.lineage-action-button:hover,
.showcase-detail-actions .detail-edit-button:hover {
    background: #d94f0f;
    transform: translateY(-1px);
}

@media (max-width: 900px) {
    .detail-showcase-layout {
        grid-template-columns: 1fr;
    }

    .detail-showcase-sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .showcase-main-image,
    .showcase-thumbnail-grid {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .chicken-modal-dialog.is-detail-showcase {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        padding: 10px;
        border-radius: 18px;
    }

    .is-detail-showcase .chicken-modal-header {
        top: 18px;
        right: 18px;
    }

    .detail-showcase-layout,
    .detail-showcase-sidebar,
    .detail-showcase-main {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .showcase-overview-card,
    .showcase-history-card {
        padding: 18px;
    }

    .showcase-fact-grid,
    .showcase-lineage-grid,
    .showcase-vaccine-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .showcase-lineage-grid > div:last-child,
    .showcase-vaccine-panel > div:first-child {
        grid-column: 1 / -1;
    }

    .showcase-title-row {
        padding-right: 38px;
    }

    .showcase-detail-actions {
        width: 100%;
    }
}

/* =====================================================
   11. SICK LIST FILTERS AND HEALTH BADGES
   ===================================================== */
.chicken-filter-panel.is-sick-filter {
    grid-template-columns: minmax(190px, 1.45fr) repeat(4, minmax(145px, 1fr)) auto;
    align-items: start;
    gap: 12px;
}

.is-sick-filter .filter-search-field {
    grid-column: auto;
}

.is-sick-filter .filter-field {
    position: relative;
    min-width: 0;
    padding-bottom: 18px;
}

.is-sick-filter .clear-filter-button {
    align-self: start;
    margin-top: 27px;
}

.chicken-filter-panel .custom-dropdown,
.chicken-date-dropdown {
    position: relative;
    min-width: 0;
}

.chicken-filter-panel .custom-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
}

.chicken-filter-panel .custom-dropdown-label,
.chicken-date-filter-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chicken-filter-panel .custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    z-index: 300;
    min-width: 170px;
    max-width: min(280px, calc(100vw - 28px));
    max-height: min(280px, calc(100vh - 24px));
    padding: 6px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.chicken-filter-panel .custom-dropdown-menu[hidden] {
    display: none !important;
}

.chicken-filter-panel .custom-dropdown-option {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #374151;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.chicken-filter-panel .custom-dropdown-option:hover,
.chicken-filter-panel .custom-dropdown-option:focus-visible,
.chicken-filter-panel .custom-dropdown-option[aria-selected="true"] {
    background: #eef7f1;
    color: #166534;
    font-weight: 600;
    outline: none;
}

.chicken-filter-panel .custom-dropdown-option[aria-selected="true"]::after {
    content: "✓" !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    color: #166534 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    line-height: 1 !important;
}

@media (max-width: 640px) {
    .chicken-filter-panel .custom-dropdown-menu {
        left: 0 !important;
        right: 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

.chicken-date-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 55;
    width: min(430px, calc(100vw - 48px));
    padding: 14px;
    background: #ffffff;
    border: 1px solid #dfe7e2;
    border-radius: 16px;
    box-shadow: 0 18px 46px rgba(22, 46, 31, 0.18);
}

.chicken-date-panel[hidden],
.chicken-date-custom[hidden],
.chicken-date-range[hidden],
.chicken-date-actions[hidden] {
    display: none;
}

.chicken-date-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.chicken-date-presets button {
    min-height: 38px;
    padding: 7px 10px;
    background: #f6f8f7;
    color: #425248;
    border: 1px solid #e2e8e4;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}

.chicken-date-presets button:hover,
.chicken-date-presets button:focus-visible,
.chicken-date-presets button.is-active {
    background: #e9f4ed;
    color: #214b34;
    border-color: #88aa95;
    outline: none;
}

.chicken-date-custom,
.chicken-date-range {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e7ece9;
}

.chicken-date-range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.chicken-date-custom label,
.chicken-date-range label {
    display: block;
    margin-bottom: 6px;
    color: #58675e;
    font-size: 12px;
    font-weight: 600;
}

.chicken-date-panel .thai-datetime-control {
    width: 100%;
    min-width: 0;
}

.chicken-date-panel input[type="date"] {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #d8e1db;
    border-radius: 10px;
}

.filter-error {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 16px;
    color: #a43129;
    font-size: 11px;
    line-height: 1.3;
}

.chicken-date-panel-error {
    position: static;
    display: block;
    min-height: 0;
    margin-top: 10px;
}

.chicken-date-panel-error:empty {
    display: none;
}

.chicken-date-filter-field.has-error .custom-dropdown-toggle {
    border-color: #bd3f35;
    box-shadow: 0 0 0 3px rgba(189, 63, 53, 0.10);
}

.vaccine-date-range {
    grid-template-columns: 1fr;
}

.chicken-date-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e7ece9;
}

.chicken-date-apply {
    min-height: 38px;
    padding: 7px 18px;
    color: #ffffff;
    background: #17653d;
    border: 1px solid #17653d;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.chicken-date-apply:hover,
.chicken-date-apply:focus-visible {
    background: #0f5131;
    border-color: #0f5131;
    outline: 3px solid rgba(23, 101, 61, 0.18);
    outline-offset: 2px;
}

.severity-mild {
    background: #e4f5e9;
    color: #25623a;
}

.severity-moderate {
    background: #fff0c9;
    color: #7b5907;
}

.severity-severe {
    background: #f9d9d6;
    color: #a32f27;
}

.severity-emergency {
    background: #7f1d1d;
    color: #ffffff;
}

.status-treatment {
    background: #e8edf8;
    color: #334d82;
}

#new-sick-updated-at-display[readonly] {
    background: #f2f6f3;
    color: #355b46;
    cursor: default;
}

@media (max-width: 1400px) {
    .chicken-filter-panel.is-sick-filter {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .is-sick-filter .clear-filter-button {
        width: 100%;
    }
}

@media (max-width: 980px) {
    .chicken-filter-panel.is-sick-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chicken-date-panel {
        right: auto;
        left: 0;
    }
}

@media (max-width: 520px) {
    .chicken-filter-panel.is-sick-filter {
        grid-template-columns: 1fr;
    }

    .chicken-date-panel {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: min(70vh, 520px);
        overflow-y: auto;
    }

    .chicken-date-presets,
    .sick-date-range {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   10. ADD SICK CHICKEN AUTOCOMPLETE
   ===================================================== */
.list-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.add-sick-chicken-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 17px;
    background: #a83a32;
    color: #ffffff;
    border: 1px solid #f7f5f5;
    border-radius: 14px;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 550;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.add-sick-chicken-button[hidden] {
    display: none;
}

.add-sick-chicken-button:hover {
    background: #922f28;
    transform: translateY(-1px);
}

.add-sick-chicken-button:focus-visible {
    outline: 3px solid rgba(168, 58, 50, 0.22);
    outline-offset: 3px;
}

.chicken-modal-dialog.is-sick-entry {
    width: min(900px, calc(100vw - 40px));
    max-height: min(900px, calc(100vh - 40px));
}

.sick-autocomplete {
    position: relative !important;
    z-index: 1050 !important;
}

.sick-autocomplete-control {
    position: relative !important;
}

.sick-autocomplete-control > i {
    position: absolute !important;
    top: 50% !important;
    left: 15px !important;
    transform: translateY(-50%) !important;
    z-index: 2 !important;
    color: #78867d !important;
    font-size: 16px !important;
    line-height: 1 !important;
    pointer-events: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease !important;
}

/* Hide search icon when user types or chicken is selected */
.sick-autocomplete-control:has(input[type="search"]:not(:placeholder-shown)) > i,
.sick-autocomplete-control.has-value > i {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(-50%) scale(0.75) !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field .sick-autocomplete-control input[type="search"],
.sick-autocomplete-control input[type="search"] {
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    padding-left: 42px !important;
    padding-right: 14px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    color: #17231c !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 12px !important;
    outline: none !important;
    font: inherit !important;
    transition: border-color 160ms ease, box-shadow 160ms ease !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field .sick-autocomplete-control input[type="search"]:focus,
.sick-autocomplete-control input[type="search"]:focus {
    border-color: #355b46 !important;
    box-shadow: 0 0 0 3px rgba(53, 91, 70, 0.12) !important;
}

#chicken-modal #chicken-modal-dialog.modal-size-medium .health-modal-form .chicken-form-field .sick-autocomplete-control input.invalid,
.sick-autocomplete-control input.invalid {
    border-color: #bd3f35 !important;
    box-shadow: 0 0 0 3px rgba(189, 63, 53, 0.10) !important;
}

.sick-autocomplete-menu {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 1050 !important;
    max-height: 260px !important;
    padding: 6px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 #f8fafc !important;
}

.sick-autocomplete-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 56px !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    background: transparent !important;
    color: #17231c !important;
    border: 0 !important;
    border-bottom: 1px solid #f0f0f0 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font: inherit !important;
    text-align: left !important;
    transition: background-color 0.14s ease, color 0.14s ease !important;
}

.sick-autocomplete-option:last-child {
    border-bottom: 0 !important;
}

.sick-autocomplete-option:hover,
.sick-autocomplete-option.is-active,
.sick-autocomplete-option:focus-visible {
    background: #f0fdf4 !important;
    outline: none !important;
}

.sick-autocomplete-option img {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    object-fit: cover !important;
    background: #edf1ee !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
}

.sick-option-copy {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    text-align: left !important;
}

.sick-option-copy strong {
    display: block !important;
    color: #166534 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.01em !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sick-option-copy b {
    display: block !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sick-option-copy small {
    display: block !important;
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sick-autocomplete-option > i {
    color: #94a3b8 !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    transition: transform 0.14s ease, color 0.14s ease !important;
}

.sick-autocomplete-option:hover > i {
    color: #166534 !important;
    transform: translateX(2px) !important;
}

.sick-autocomplete-message {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-height: 80px !important;
    padding: 18px 12px !important;
    color: #647168 !important;
    font-size: 13.5px !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.sick-autocomplete-message i {
    font-size: 20px !important;
    color: #94a3b8 !important;
}

.sick-autocomplete-message.is-empty i {
    color: #ef4444 !important;
}

.selected-sick-chicken {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(145deg, #f4f9f6, #ffffff);
    border: 1px solid #dce8e0;
    border-radius: 17px;
}

.selected-sick-chicken[hidden] {
    display: none;
}

.selected-sick-chicken > img {
    width: 82px;
    height: 82px;
    object-fit: cover;
    background: #e8eeea;
    border-radius: 14px;
}

.selected-sick-chicken span,
.selected-sick-chicken strong,
.selected-sick-chicken p,
.selected-sick-chicken small {
    display: block;
}

.selected-sick-chicken span {
    color: #355b46;
    font-size: 12px;
    font-weight: 700;
}

.selected-sick-chicken strong {
    margin-top: 2px;
    color: #17231c;
    font-size: 18px;
}

.selected-sick-chicken p,
.selected-sick-chicken small {
    margin-top: 4px;
    color: #68756d;
    font-size: 12px;
}

.selected-sick-chicken button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    background: #ffffff;
    color: #8b3b35;
    border: 1px solid #e1c2bf;
    border-radius: 50%;
    cursor: pointer;
}

@media (max-width: 768px) {
    .list-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .add-sick-chicken-button {
        width: 100%;
    }

    .page-size-label {
        align-self: flex-end;
    }
}

@media (max-width: 620px) {
    .chicken-modal-dialog.is-sick-entry {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }

    .sick-autocomplete-menu {
        top: calc(100% + 4px) !important;
        max-height: 240px;
    }

    .sick-autocomplete-option {
        padding: 8px 10px !important;
        gap: 10px !important;
    }

    .sick-autocomplete-option img {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
    }

    .sick-autocomplete-option > i {
        display: none !important;
    }

    .selected-sick-chicken {
        grid-template-columns: 66px minmax(0, 1fr) 36px;
    }

    .selected-sick-chicken > img {
        width: 66px;
        height: 66px;
    }
}

@media (max-width: 520px) {
    .dashboard-topbar {
        padding: 0;
        background: transparent;
    }

    .topbar-actions {
        justify-content: space-between;
    }

    .topbar-actions .icon-btn {
        width: 44px;
        height: 44px;
    }

    .chicken-list-section {
        padding: 0;
    }

    .chicken-table tbody tr {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .chicken-table td.chicken-name-cell,
    .chicken-table td.action-cell {
        grid-column: auto;
    }

    .chicken-identity strong {
        max-width: calc(100vw - 142px);
    }

    .chicken-modal {
        padding: 10px;
    }

    .chicken-modal-dialog {
        max-height: calc(100vh - 20px);
        padding: 18px;
        border-radius: 20px;
    }

    .detail-section {
        padding: 16px;
    }

    .sticky-form-actions {
        bottom: -18px;
        margin-right: -18px;
        margin-left: -18px;
        padding: 16px 18px 18px;
    }

    .edit-form-actions {
        flex-direction: column-reverse;
    }

    .modal-cancel-button,
    .modal-save-button,
    .detail-edit-button {
        width: 100%;
    }

    .detail-modal-actions {
        align-items: stretch;
    }

    .chicken-toast {
        right: 14px;
        bottom: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chicken-summary-card,
    .add-chicken-button,
    .detail-edit-button,
    .chicken-table tbody tr,
    .row-action-button,
    .chicken-pagination button,
    .chicken-modal-backdrop,
    .chicken-modal-dialog,
    .chicken-toast,
    .remove-preview-button,
    .detail-main-image-link img,
    .detail-media-item img,
    .sidebar-overlay {
        transition: none;
    }

    .chicken-summary-card:hover,
    .add-chicken-button:hover,
    .detail-edit-button:hover,
    .detail-main-image-link:hover img,
    .detail-media-item:hover img,
    .chicken-table tbody tr:hover,
    .row-action-button:hover,
    .chicken-pagination button:hover:not(:disabled) {
        transform: none;
    }
}
/* =========================================
   ปรับขนาดรายการไก่ให้เล็กและไม่ยาวเกินไป
   ========================================= */

.chicken-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.chicken-table td {
    padding: 9px 11px;
    font-size: 12px;
}

.chicken-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
}

.chicken-identity img {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px;
}

.chicken-identity strong {
    max-width: 130px;
    overflow: hidden;
    color: #17231c;
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chicken-identity span {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 14px;
}

.data-badge {
    min-height: 36px;
    padding: 0 13px;
    font-size: 14px;
    border-radius: 999px;
}

.row-action-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
}

/* =====================================================
   09. CONTEXT TABLES (Mock Data)
   ตารางทั้ง 5 โหมด, Active state และประวัติใน Modal
   ===================================================== */
.chicken-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.chicken-summary-card {
    grid-template-columns: 44px minmax(0, 1fr);
    min-height: 126px;
    padding: 18px;
}

.chicken-summary-card .summary-card-arrow {
    position: absolute;
    top: 16px;
    right: 16px;
}

.summary-card-icon {
    width: 44px;
    height: 44px;
    font-size: 23px;
}

.summary-card-label {
    padding-right: 18px;
    font-size: 14px;
}

.summary-card-content strong {
    font-size: 28px;
}

.summary-all .summary-card-icon {
    background: #e8f2ec;
    color: #285a3e;
}

.summary-father .summary-card-icon {
    background: #e7efff;
    color: #2457a6;
}

.summary-mother .summary-card-icon {
    background: #fce8f2;
    color: #a33268;
}

.summary-sick .summary-card-icon {
    background: #feebea;
    color: #b43c35;
}

.summary-vaccine .summary-card-icon {
    background: #fff2cf;
    color: #946b06;
}

.chicken-summary-card.is-active {
    color: #ffffff;
    background: linear-gradient(145deg, #234b35, #356a4c);
    border-color: #1d3d2c;
    box-shadow: 0 15px 34px rgba(29, 61, 44, 0.28), 0 0 0 3px rgba(178, 138, 46, 0.18);
}

.chicken-summary-card.is-active .summary-card-label,
.chicken-summary-card.is-active .summary-card-content small,
.chicken-summary-card.is-active .summary-card-arrow {
    color: #ffffff;
}

.chicken-summary-card.is-active .summary-card-icon {
    background: #ffffff;
    color: #1d3d2c;
}

.chicken-filter-panel {
    grid-template-columns:
        minmax(220px, 1.7fr)
        repeat(5, minmax(105px, 1fr))
        minmax(130px, auto);
    align-items: end;
    gap: 10px;
}

.filter-search-field {
    grid-column: auto;
}

.filter-field input[type="date"] {
    padding-left: 13px;
}

.chicken-table {
    min-width: 1100px;
}

.wrap-cell {
    max-width: 230px;
    line-height: 1.55;
    white-space: normal !important;
}

.stacked-actions {
    align-items: stretch;
    flex-direction: column;
}

.edit-action-button {
    color: #a53b32;
    border-color: #d88a83;
}

.vaccine-action-button {
    color: #76590a;
    border-color: #d4b858;
}

.status-success {
    background: #e7f6ec;
    color: #23623b;
}

.status-warning,
.status-overdue {
    background: #fde9e7;
    color: #aa342c;
}

.status-upcoming {
    background: #fff3d6;
    color: #805d08;
}

.status-due {
    background: #ffe1b8;
    color: #8f4c00;
}

.status-father {
    background: #e7efff;
    color: #2457a6;
}

.status-mother {
    background: #fce8f2;
    color: #a33268;
}

.status-general {
    background: #eef1ef;
    color: #536159;
}

.status-sold {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid rgba(22, 163, 74, 0.3);
}

.vaccine-cell {
    display: grid;
    justify-items: start;
    gap: 6px;
    min-width: 170px;
}

.vaccine-cell span:not(.data-badge) {
    color: #68756d;
    font-size: 12px;
}

.chicken-modal-dialog {
    width: min(1500px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
}

.history-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.history-card {
    padding: 18px;
    background: #f8faf9;
    border: 1px solid #e4ebe7;
    border-radius: 16px;
}

.history-card > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8e4;
}

.history-card time {
    color: #647168;
    font-size: 12px;
}

.history-card p {
    margin-top: 6px;
    color: #48564e;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .history-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .chicken-modal-dialog {
        width: calc(100vw - 20px);
    }
}
.chickens-page .chicken-list-section {
    border-radius: 20px !important;
    background: #ffffff !important;
}


/* =====================================================
   Legacy grid rules neutralized — Unified Flex Toolbar is maintained below
   ===================================================== */
.filter-field {
    display: grid;
    gap: 0;
    min-width: 0;
}

.is-sick-filter .filter-field {
    padding-bottom: 0;
}

.is-sick-filter .clear-filter-button {
    align-self: center;
    margin-top: 0;
}
/* ==================================================
   บังคับ Popup ให้เต็มหน้าจอจริง
================================================== */

html,
body {
    width: 100%;
    min-height: 100%;
}

/* พื้นที่ Modal คลุมทั้งหน้าจอ */
#chicken-modal.chicken-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;

    width: 100vw !important;
    max-width: none !important;

    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    display: block !important;
    overflow: hidden !important;

    transform: none !important;
}

/* hidden ต้องซ่อนจริง */
#chicken-modal.chicken-modal[hidden] {
    display: none !important;
}

/* พื้นหลังมืดเต็มหน้าจอ */
#chicken-modal .chicken-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1 !important;

    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;

    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
    background: rgba(15, 23, 42, 0.62) !important;
}

/* กล่องเนื้อหาเต็มหน้าจอ */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2 !important;

    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;

    width: 100vw !important;
    min-width: 100vw !important;
    max-width: none !important;

    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    display: flex !important;
    flex-direction: column !important;

    overflow: hidden !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: #ffffff !important;
    box-shadow: none !important;

    transform: none !important;
}

/* ส่วนหัว */
#chicken-modal .chicken-modal-header {
    position: relative !important;
    top: auto !important;
    z-index: 20 !important;

    flex: 0 0 auto !important;

    width: 100% !important;
    min-height: 76px !important;

    margin: 0 !important;
    padding: 16px 28px !important;

    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* เนื้อหาที่แสดง */
#chicken-modal .chicken-detail-view:not([hidden]),
#chicken-modal .chicken-edit-form:not([hidden]),
#chicken-modal .chicken-entry-form:not([hidden]),
#chicken-modal .chicken-vaccine-form:not([hidden]) {
    flex: 1 1 auto !important;

    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 24px 30px 50px !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;

    overscroll-behavior: contain;
}

/* ซ่อนฟอร์มที่ไม่ได้ใช้งาน */
#chicken-modal .chicken-detail-view[hidden],
#chicken-modal .chicken-edit-form[hidden],
#chicken-modal .chicken-entry-form[hidden],
#chicken-modal .chicken-vaccine-form[hidden] {
    display: none !important;
}

/* รายละเอียดไก่ใช้พื้นที่กว้างเต็ม */
#chicken-modal .detail-modal-layout,
#chicken-modal .detail-modal-content,
#chicken-modal .detail-content-grid,
#chicken-modal .chicken-detail-layout {
    width: 100% !important;
    max-width: none !important;
}

/* ปุ่มปิดให้อยู่มุมขวา */
#chicken-modal .modal-close-button {
    position: absolute !important;
    top: 16px !important;
    right: 20px !important;
    z-index: 30 !important;

    width: 46px !important;
    height: 46px !important;

    border-radius: 50% !important;
}

/* ปุ่มบันทึกด้านล่าง */
#chicken-modal .edit-form-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;

    width: calc(100% + 60px) !important;

    margin: 28px -30px -50px !important;
    padding: 16px 30px !important;

    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid #e5e7eb !important;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ป้องกันหน้าเว็บด้านหลังเลื่อน */
body.modal-open {
    overflow: hidden !important;
}

/* ==================================================
   MOBILE
================================================== */

@media (max-width: 640px) {
    #chicken-modal .chicken-modal-header {
        min-height: 64px !important;
        padding: 12px 14px !important;
    }

    #chicken-modal .chicken-detail-view:not([hidden]),
    #chicken-modal .chicken-edit-form:not([hidden]),
    #chicken-modal .chicken-entry-form:not([hidden]),
    #chicken-modal .chicken-vaccine-form:not([hidden]) {
        padding: 16px 14px 34px !important;
    }

    #chicken-modal .modal-close-button {
        top: 10px !important;
        right: 12px !important;

        width: 42px !important;
        height: 42px !important;
        border-radius: 50% !important;
    }

    #chicken-modal .edit-form-actions {
        width: calc(100% + 28px) !important;

        margin: 22px -14px -34px !important;
        padding: 12px 14px !important;

        flex-direction: column-reverse !important;
    }

    #chicken-modal .modal-cancel-button,
    #chicken-modal .modal-save-button {
        width: 100% !important;
    }
}
#chicken-modal .chicken-modal-header {
    width: 100%;
    min-height: 76px;
    padding: 14px 24px;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

/* บังคับข้อความให้อยู่ซ้าย */
#chicken-modal .chicken-modal-header > div {
    margin: 0 !important;
    padding: 0 !important;

    display: block !important;
    text-align: left !important;
}

#chicken-modal .modal-eyebrow {
    display: block;
    margin: 0 0 3px;

    text-align: left !important;
}

#chicken-modal #chicken-modal-title {
    margin: 0;

    text-align: left !important;
    font-size: 24px;
    font-weight: 800;
}

/* ปุ่ม X อยู่ขวา */
#chicken-modal .modal-close-button {
    position: static !important;
    margin-left: auto !important;
    border-radius: 50% !important;

    flex: 0 0 46px;
    width: 46px;
    height: 46px;
}
/* หัว Popup: ข้อความซ้าย ปุ่ม X ขวา */
#chicken-modal .chicken-modal-header {
    position: relative !important;

    width: 100% !important;
    min-height: 76px !important;
    padding: 0 24px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;

    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* ซ่อนข้อความเดิม ป้องกัน JavaScript เปลี่ยนแล้วซ้ำ */
#chicken-modal .chicken-modal-header > div {
    display: none !important;
}

/* สร้างข้อความใหม่ไว้ด้านซ้ายแน่นอน */
#chicken-modal .chicken-modal-header::before {
    content: none !important;
    display: none !important;

    position: absolute !important;
    left: 40px !important;
    top: 50% !important;

    display: block !important;

    color: #111827 !important;

    font-family: "Prompt", "Noto Sans Thai", sans-serif !important;
    font-size: 24px !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;

    opacity: 1 !important;
    visibility: visible !important;

    transform: translateY(-50%) !important;
}

/* ปุ่ม X อยู่ด้านขวา */
#chicken-modal .modal-close-button {
    position: static !important;

    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;

    margin: 0 !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    border-radius: 50% !important;
}

/* ==================================================
   หัว Popup: ปุ่ม 3 ปุ่มซ้าย และ X ขวา
================================================== */

#chicken-modal .chicken-modal-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;

    width: 100% !important;
    min-height: 76px !important;
    padding: 12px 28px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px !important;

    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* กลุ่มปุ่มด้านซ้าย */
#chicken-modal .modal-header-actions {
    min-width: 0;
    flex: 1 1 auto;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto !important;
}

/* ปุ่มทั้ง 3 */
#chicken-modal .modal-header-action-button {
    min-height: 44px;
    padding: 0 17px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border: 1px solid #e5e7eb;
    border-radius: 999px;

    background: #ffffff;
    color: #374151;

    font-family: "Prompt", "Noto Sans Thai", sans-serif;
    font-size: 14px;
    font-weight: 700;

    white-space: nowrap;
    cursor: pointer;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#chicken-modal .modal-header-action-button:hover {
    transform: translateY(-2px);
    border-color: #111827;

    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

#chicken-modal .action-sell:hover {
    background: #d9480f;
    border-color: #d9480f;
    color: #ffffff;
}

/* ปุ่มแผนผังสายเลือด */
#chicken-modal .action-lineage {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

#chicken-modal .action-lineage:hover {
    background: #166534;
    border-color: #166534;
    color: #ffffff;
}

#chicken-modal .action-edit:hover {
    background: #374151;
    border-color: #374151;
    color: #ffffff;
}

/* ปุ่ม X อยู่ขวาสุด */
#chicken-modal .modal-close-button {
    position: static !important;
    inset: auto !important;

    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;

    margin: 0 0 0 auto !important;
    padding: 0 !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important;

    background: #ffffff !important;
    color: #374151 !important;

    font-size: 20px !important;
    cursor: pointer !important;

    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1) !important;
}

#chicken-modal .modal-close-button:hover {
    background: #111827 !important;
    border-color: #111827 !important;
    color: #ffffff !important;

    transform: rotate(90deg) !important;
}

/* แก้กฎเก่าที่ซ่อน div ทุกตัวใน Header */
#chicken-modal .chicken-modal-header > .modal-header-title {
    position: static !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#chicken-modal .chicken-modal-header > .modal-header-actions:not([hidden]) {
    position: static !important;
    display: flex !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    clip: auto !important;
    white-space: normal !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#chicken-modal .chicken-modal-header > .modal-header-actions[hidden] {
    display: none !important;
}

/* Tablet */
@media (max-width: 800px) {
    #chicken-modal .chicken-modal-header {
        padding: 10px 16px !important;
    }

    #chicken-modal .modal-header-action-button {
        min-height: 42px;
        padding: 0 13px;
        font-size: 12px;
    }
}

/* Mobile เลื่อนปุ่มซ้าย-ขวาได้ */
@media (max-width: 640px) {
    #chicken-modal .chicken-modal-header {
        min-height: 66px !important;
        padding: 10px 12px !important;
        gap: 10px !important;
    }

    #chicken-modal .modal-header-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;

        scrollbar-width: none;
    }

    #chicken-modal .modal-header-actions::-webkit-scrollbar {
        display: none;
    }

    #chicken-modal .modal-header-action-button {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 0 12px;
    }

    #chicken-modal .modal-close-button {
        flex-basis: 42px !important;
        width: 42px !important;
        height: 42px !important;
        border-radius: 50% !important;
    }
}

/* Header actions: แสดงเฉพาะโหมดรายละเอียดและคงปุ่ม X ไว้ขวาสุด */
#chicken-modal .modal-header-actions {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

#chicken-modal .modal-header-actions::-webkit-scrollbar {
    display: none;
}

#chicken-modal .modal-header-actions[hidden] {
    display: none !important;
}

#chicken-modal .modal-header-action-button:focus-visible,
#chicken-modal .modal-close-button:focus-visible {
    outline: 3px solid rgba(242, 101, 34, 0.24) !important;
    outline-offset: 2px;
}

#chicken-modal .modal-header-action-button.is-active {
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.18);
}

/* ลำดับหัว Popup: ชื่อด้านซ้าย > ปุ่มคำสั่ง > ปุ่มปิดด้านขวา */
#chicken-modal .chicken-modal-header {
    flex-wrap: nowrap !important;
}

#chicken-modal .modal-header-title {
    display: block !important;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

#chicken-modal .modal-header-title .modal-eyebrow {
    display: none !important;
}

#chicken-modal .modal-header-title #chicken-modal-title {
    display: block !important;
    margin: 0 !important;
    color: #111827;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
}

#chicken-modal .modal-header-title + .modal-header-actions {
    flex: 1 1 auto;
    width: auto;
}

@media (max-width: 640px) {
    #chicken-modal .modal-header-title #chicken-modal-title {
        font-size: 16px;
    }

    #chicken-modal .modal-header-title + .modal-header-actions {
        min-width: 0;
    }
}
/* หัว Popup */
#chicken-modal .chicken-modal-header {
    width: 100%;
    min-height: 76px;
    padding: 12px 28px;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

/* กลุ่มปุ่มด้านซ้าย */
#chicken-modal .modal-header-actions {
    flex: 1 1 auto;

    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;

    visibility: visible !important;
    opacity: 1 !important;
}

/* ปุ่มทั้ง 3 */
#chicken-modal .modal-header-action-button {
    min-height: 44px;
    padding: 0 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border: 1px solid #e5e7eb;
    border-radius: 999px;

    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;

    cursor: pointer;
}

/* ประกาศขาย */
#chicken-modal .action-sell {
    background: #f05a1a;
    border-color: #f05a1a;
    color: #ffffff;
}

/* แผนผังสายเลือด */
#chicken-modal .action-lineage {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}

/* แก้ไขข้อมูลไก่ */
#chicken-modal .action-edit {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

/* ปุ่ม X ขวาสุด */
#chicken-modal .modal-close-button {
    position: static !important;

    flex: 0 0 46px;
    width: 46px;
    height: 46px;

    margin-left: auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50% !important;
}

/* เอาข้อความเก่าจาก ::before ออก */
#chicken-modal .chicken-modal-header::before {
    content: none !important;
    display: none !important;
}
/* ทำให้ปุ่มทั้ง 3 ชิดกัน */
#chicken-modal .modal-header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;

    gap: 6px !important;
    margin-left: auto !important;
}

/* ห้ามแต่ละปุ่มดันตัวเองออกจากกัน */
#chicken-modal .modal-header-action-button,
#chicken-modal .action-sell,
#chicken-modal .action-lineage,
#chicken-modal .action-edit {
    margin: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;

    flex: 0 0 auto !important;
}

/* เว้นระยะระหว่างกลุ่มปุ่มกับ X */
#chicken-modal .modal-close-button {
    margin-left: 20px !important;
}

/* Accordion ประวัติสุขภาพใน Popup รายละเอียดไก่ */
#chicken-modal .health-history-accordion {
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

#chicken-modal .health-history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 68px;
    padding: 14px 16px;
    background: #ffffff;
    color: #111827;
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

#chicken-modal .health-history-toggle:hover {
    background: #f8faf9;
}

#chicken-modal .health-history-toggle:focus-visible {
    outline: 3px solid rgba(53, 91, 70, 0.18);
    outline-offset: -3px;
}

#chicken-modal .health-history-toggle-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

#chicken-modal .health-history-toggle-left > i {
    display: inline-flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: #edf4ef;
    color: #355b46;
    border-radius: 12px;
    font-size: 18px;
}

#chicken-modal .health-history-toggle-left strong,
#chicken-modal .health-history-toggle-left small {
    display: block;
}

#chicken-modal .health-history-toggle-left strong {
    font-size: 16px;
    font-weight: 700;
}

#chicken-modal .health-history-toggle-left small {
    margin-top: 3px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.45;
}

#chicken-modal .health-history-chevron {
    flex: 0 0 auto;
    font-size: 18px;
    transition: transform 0.22s ease;
}

#chicken-modal .health-history-toggle[aria-expanded="true"] .health-history-chevron {
    transform: rotate(180deg);
}

#chicken-modal .health-history-content {
    padding: 0 16px 16px;
    overflow-x: hidden;
}

#chicken-modal .health-history-content[hidden] {
    display: none !important;
}

#chicken-modal .health-history-content .history-list {
    grid-template-columns: 1fr;
}

@media (max-width: 640px) {
    #chicken-modal .health-history-toggle {
        gap: 10px;
        padding: 12px;
    }

    #chicken-modal .health-history-toggle-left > i {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    #chicken-modal .health-history-toggle-left strong {
        font-size: 14px;
    }

    #chicken-modal .health-history-content {
        padding: 0 12px 12px;
    }
}

/* Final edit-showcase cascade: keep later legacy modal rules from flattening edit mode. */
#chicken-modal .chicken-modal-dialog.is-detail-showcase.is-edit-showcase {
    width: min(1180px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    background: #f5f6f2;
}

#chicken-modal .chicken-edit-form.detail-showcase-edit:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.52fr);
    gap: 18px;
    padding: 18px;
    overflow: auto;
    align-items: start;
    background: #f5f6f2;
}

#chicken-modal .chicken-edit-form.detail-showcase-edit[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    #chicken-modal .chicken-edit-form.detail-showcase-edit:not([hidden]) {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
    }
}

@media (max-width: 560px) {
    #chicken-modal .chicken-modal-dialog.is-detail-showcase.is-edit-showcase {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
}

#chicken-modal .lineage-autocomplete {
    position: relative;
}

#chicken-modal .lineage-autocomplete-control {
    position: relative;
    display: block;
    width: 100%;
}

#chicken-modal .lineage-autocomplete-control > i {
    position: absolute;
    top: 50%;
    left: 12px;
    z-index: 2;
    transform: translateY(-50%);
    font-size: 15px;
    line-height: 1;
    color: #7a857e;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

#chicken-modal .lineage-autocomplete-control.has-value > i,
#chicken-modal .lineage-autocomplete-control.is-filled > i,
#chicken-modal .lineage-autocomplete-control:has(input[type="text"]:not(:placeholder-shown)) > i {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#chicken-modal .lineage-autocomplete-control input[type="text"],
#chicken-modal .lineage-autocomplete-control input {
    padding-left: 36px;
    padding-right: 12px;
}

#chicken-modal .lineage-autocomplete-menu {
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    left: 0;
    z-index: 30;
    overflow-y: auto;
    max-height: 280px;
    padding: 6px;
    border: 1px solid #dfe5df;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(26, 48, 35, 0.16);
}

#chicken-modal .lineage-autocomplete-menu[hidden] {
    display: none !important;
}

#chicken-modal .lineage-autocomplete-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    color: #25342b;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

#chicken-modal .lineage-autocomplete-menu button:hover,
#chicken-modal .lineage-autocomplete-menu button:focus-visible {
    background: #edf5ef;
    outline: none;
}

#chicken-modal .lineage-autocomplete-menu img {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
}

#chicken-modal .lineage-autocomplete-menu span {
    display: grid;
    min-width: 0;
}

#chicken-modal .lineage-autocomplete-menu strong,
#chicken-modal .lineage-autocomplete-menu small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chicken-modal .lineage-autocomplete-menu small,
#chicken-modal .lineage-autocomplete-empty {
    color: #758077;
    font-size: 0.72rem;
}

#chicken-modal .lineage-autocomplete-empty {
    padding: 14px 10px;
    text-align: center;
}
/* ==================================================
   รวมข้อมูลประจำตัว สายเลือด สุขภาพและวัคซีน
   ให้ดูเป็นกล่องเดียวกัน
================================================== */

#chicken-modal .detail-showcase-edit .edit-showcase-info-group {
    grid-column: 2 !important;
    grid-row: 1 / span 3 !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    align-self: start !important;
    box-sizing: border-box !important;

    background: #ffffff !important;
    border: 1px solid #e7e9e4 !important;
    border-radius: 16px !important;

    box-shadow: 0 6px 18px rgba(24, 39, 31, 0.05) !important;
}

/* ลบรูปแบบกล่องแยกของทั้ง 3 Section */
#chicken-modal .edit-showcase-info-group > section {
    grid-column: auto !important;
    grid-row: auto !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;

    margin: 0 !important;
    padding: 22px !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: transparent !important;
    box-shadow: none !important;
}

/* ลบระยะห่างเดิมของ Section */
#chicken-modal .edit-showcase-info-group > .edit-form-section {
    margin-top: 0 !important;
}

/* เส้นแบ่งระหว่างแต่ละส่วน */
#chicken-modal .edit-showcase-info-group > section + section {
    border-top: 1px solid #e7e9e4 !important;
}

/* ลดระยะบนของหัวข้อในส่วนที่ 2 และ 3 */
#chicken-modal .edit-showcase-info-group .chicken-form-section-heading {
    margin-top: 0 !important;
}

/* บังคับตำแหน่งรูปและประวัติการชนฝั่งซ้าย */
#chicken-modal .detail-showcase-edit .edit-showcase-media {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

#chicken-modal .detail-showcase-edit .edit-showcase-fight {
    grid-column: 1 !important;
    grid-row: 2 !important;
}

@media (max-width: 900px) {
    #chicken-modal .detail-showcase-edit .edit-showcase-media {
        grid-column: 1 !important;
        grid-row: auto !important;
        order: 1 !important;
    }

    #chicken-modal .detail-showcase-edit .edit-showcase-info-group {
        grid-column: 1 !important;
        grid-row: auto !important;
        order: 2 !important;
    }

    #chicken-modal .detail-showcase-edit .edit-showcase-fight {
        grid-column: 1 !important;
        grid-row: auto !important;
        order: 3 !important;
    }

    #chicken-modal .detail-showcase-edit .edit-form-actions {
        order: 4 !important;
    }
}

@media (max-width: 560px) {
    #chicken-modal .edit-showcase-info-group > section {
        padding: 16px !important;
    }
}
/* ==================================================
   แถบปุ่มแก้ไขให้ติดขอบล่าง Popup จริง
================================================== */

#chicken-modal
.detail-showcase-edit:not([hidden]) {
    padding-bottom: 0 !important;
}

/* แถบปุ่ม ยกเลิก / บันทึก */
#chicken-modal
.detail-showcase-edit
.edit-form-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 100 !important;

    grid-column: 1 / -1 !important;
    align-self: end !important;

    width: calc(100% + 36px) !important;
    min-height: 76px !important;

    margin:
        18px
        -18px
        0
        -18px !important;

    padding:
        14px
        28px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;

    background: #ffffff !important;
    border-top: 1px solid #e3e7e1 !important;

    box-shadow:
        0 -10px 24px rgba(23, 41, 31, 0.08) !important;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
/* ==================================================
   แถบปุ่ม Popup เพิ่มไก่ ติดขอบล่าง
================================================== */

#chicken-modal #add-chicken-form:not([hidden]) {
    padding-bottom: 0 !important;
}
/* ปุ่มยกเลิก / บันทึกข้อมูลไก่ */
#chicken-modal
#add-chicken-form
.sticky-form-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 100 !important;

    width: calc(100% + 64px) !important;
    min-height: 76px !important;

    margin:
        18px
        -32px
        0
        -32px !important;

    padding:
        14px
        32px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;

    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid #e3e7e1 !important;

    box-shadow:
        0 -10px 24px rgba(23, 41, 31, 0.08) !important;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
/* กรอบข้อมูลไก่ */
.chicken-table td:first-child {
    padding: 0 13px 0 0 !important;
    overflow: hidden !important;
    border-radius: 16px 0 0 16px !important;
}

/* Multiple-image manager: large primary image, thumbnails and icon actions. */
#chicken-modal .media-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#chicken-modal .media-image-manager {
    width: min(100%, 540px);
    margin-top: 12px;
}

#chicken-modal .media-image-manager .media-main-image-preview {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 250px;
    overflow: hidden;
    background: #edf2ee;
    border: 1px solid #dce5de;
    border-radius: 18px;
    aspect-ratio: 4 / 3;
}

#chicken-modal .media-image-manager .media-main-image-preview > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#chicken-modal .media-image-manager .media-main-image-preview .edit-media-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    color: #718078;
    text-align: center;
}

#chicken-modal .media-image-manager .media-main-image-preview .edit-media-empty i {
    color: #8fa399;
    font-size: 2.25rem;
}

#chicken-modal .media-primary-label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    color: #fff;
    background: rgba(10, 73, 42, 0.9);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: 0 5px 14px rgba(6, 45, 26, 0.2);
}

#chicken-modal .media-thumbnail-strip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
}

#chicken-modal .media-thumbnail-strip .image-preview-grid {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    grid-template-columns: none;
    gap: 10px;
    margin: 0;
}

#chicken-modal .managed-image-thumbnail {
    position: relative;
    flex: 0 0 86px;
    width: 86px;
    height: 76px;
    overflow: hidden;
    background: #edf2ee;
    border: 2px solid transparent;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(20, 48, 32, 0.08);
}

#chicken-modal .managed-image-thumbnail.is-primary {
    border-color: #1d7a49;
}

#chicken-modal .managed-image-select {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

#chicken-modal .managed-image-select:disabled {
    cursor: default;
}

#chicken-modal .managed-image-select img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#chicken-modal .thumbnail-primary-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    color: #fff;
    background: #1d7a49;
    border-radius: 50%;
    font-size: 0.68rem;
    box-shadow: 0 3px 8px rgba(7, 47, 27, 0.26);
    pointer-events: none;
}

#chicken-modal .managed-image-actions {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: flex;
    gap: 4px;
}

#chicken-modal .managed-image-actions button {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    color: #174d31;
    background: rgba(255, 255, 255, 0.94);
    border: 0;
    border-radius: 8px;
    font-size: 0.72rem;
    box-shadow: 0 2px 7px rgba(9, 36, 22, 0.2);
    cursor: pointer;
}

#chicken-modal .managed-image-actions .set-primary-image-button.is-active {
    color: #fff;
    background: #1d7a49;
}

#chicken-modal .managed-image-actions .delete-managed-image-button {
    color: #fff;
    background: #d94d43;
}

#chicken-modal .managed-image-actions button:hover:not(:disabled),
#chicken-modal .managed-image-actions button:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

#chicken-modal .image-add-tile {
    display: grid;
    flex: 0 0 86px;
    place-items: center;
    align-content: center;
    width: 86px;
    height: 76px;
    gap: 3px;
    color: #246743;
    background: #f4f8f5;
    border: 2px dashed #b7c7bc;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

#chicken-modal .image-add-tile i {
    font-size: 1.05rem;
}

#chicken-modal .image-add-tile:hover,
#chicken-modal .image-add-tile:focus-within {
    color: #0f5a34;
    background: #eaf5ee;
    border-color: #5f9875;
}

#chicken-modal .image-add-tile[hidden] {
    display: none !important;
}

.visually-hidden {
    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;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 620px) {
    #chicken-modal .media-image-manager .media-main-image-preview {
        min-height: 210px;
        border-radius: 14px;
    }

    #chicken-modal .managed-image-thumbnail,
    #chicken-modal .image-add-tile {
        flex-basis: 72px;
        width: 72px;
        height: 68px;
    }
}

/* กล่องรูปและข้อความ */
.chicken-identity {
    display: flex !important;
    align-items: stretch !important;
    gap: 12px !important;
    min-height: 120px !important;
}

/* รูปไก่ */
.chicken-identity img {
    flex: 0 0 120px !important;
    width: 120px !important;
    height: auto !important;
    min-height: 120px !important;

    margin: 0 !important;

    object-fit: cover !important;
    border-radius: 16px 0 0 16px !important;
}

/* ข้อความด้านขวา */
.chicken-identity > div {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
}
/* Pagination ปุ่มหน้าปัจจุบัน */
.pagination-page.is-current,
.pagination-page[aria-current="page"] {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #111111 !important;
    box-shadow: none !important;
}

/* ตัวเลขภายในปุ่มหน้าปัจจุบัน */
.pagination-page.is-current *,
.pagination-page[aria-current="page"] * {
    color: #ffffff !important;
}

/* ปุ่มหน้าที่ยังไม่ได้เลือก */
.pagination-page:not(.is-current):not([aria-current="page"]) {
    background: #ffffff !important;
    color: #1f2937 !important;
    border-color: #dfe5e1 !important;
}

/* Hover ปุ่มหน้าทั่วไป */
.pagination-page:not(.is-current):not([aria-current="page"]):hover {
    background: #f5f5f5 !important;
    color: #111111 !important;
    border-color: #111111 !important;
}
/* ==================================================
   FINAL POPUP SIZE SYSTEM
   กฎนี้อยู่ท้ายไฟล์และมี specificity สูงกว่ากฎ Fullscreen เดิม
================================================== */

#chicken-modal.chicken-modal:not([hidden]) {
    display: grid !important;
    place-items: center !important;
    padding: 20px !important;
    overflow: hidden !important;
}

/* คืนกล่องจากกฎ Fullscreen เดิมให้เป็น Modal ที่อยู่กลางหน้าจอ */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large,
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;

    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;

    background: #ffffff !important;
    transform: none !important;
}

/* รายละเอียดไก่ / แก้ไขข้อมูลไก่ / เพิ่มข้อมูลไก่ */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large {
    width: min(1180px, calc(100vw - 40px)) !important;
    max-width: 1180px !important;
    max-height: calc(100dvh - 40px) !important;

    padding: 0 !important;
    border: 1px solid #e3e8e4 !important;
    border-radius: 24px !important;
    box-shadow: 0 28px 72px rgba(15, 23, 42, 0.24) !important;
}

/* แก้ไขสุขภาพ / เพิ่มวัคซีน / เพิ่มไก่ที่ป่วย และงานย่อยที่เกี่ยวข้อง */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium {
    width: min(820px, calc(100vw - 40px)) !important;
    max-width: 820px !important;
    max-height: min(780px, calc(100dvh - 60px)) !important;

    padding: 0 !important;
    border: 1px solid #e3e8e4 !important;
    border-radius: 22px !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22) !important;
}

#chicken-modal .modal-size-medium .chicken-modal-header {
    min-height: 72px !important;
    padding: 14px 18px 14px 22px !important;
}

#chicken-modal .modal-size-medium .modal-header-title {
    min-width: 0 !important;
}

#chicken-modal .modal-size-medium .modal-header-title h2 {
    margin: 0 !important;
    font-size: 1.25rem !important;
}

#chicken-modal .modal-size-medium .modal-header-actions {
    display: none !important;
}

#chicken-modal .modal-size-medium #edit-health-form:not([hidden]),
#chicken-modal .modal-size-medium #add-vaccine-form:not([hidden]),
#chicken-modal .modal-size-medium #add-sick-chicken-form:not([hidden]),
#chicken-modal .modal-size-medium #health-history-view:not([hidden]) {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 22px !important;
    overflow: visible !important;
    background: #ffffff !important;
}

#chicken-modal .modal-size-medium .chicken-form-grid,
#chicken-modal .modal-size-medium .edit-form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

#chicken-modal .modal-size-medium .form-field-full,
#chicken-modal .modal-size-medium .edit-form-full {
    grid-column: 1 / -1 !important;
}

/* =====================================================
   POPUP เพิ่ม/แก้ไขข้อมูลการรักษา (Treatment Modal Dialog)
   Matches master visual language of Farm Cost Dialog (.farm-cost-dialog)
   ===================================================== */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium.is-treatment-dialog,
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog:has(#treatment-form:not([hidden])),
#chicken-modal #chicken-modal-dialog.is-treatment-dialog {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: min(560px, calc(100vw - 32px)) !important;
    max-width: 560px !important;
    max-height: min(90dvh, 800px) !important;
    padding: 0 !important;
    margin: 0 auto !important;
    overflow: hidden !important;
    color: #172019 !important;
    background: #ffffff !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14) !important;
    transform: none !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog > .chicken-modal-header,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) > .chicken-modal-header {
    position: relative !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    padding: 24px 76px 18px 24px !important;
    margin: 0 !important;
    border-bottom: 1px solid #eef2ef !important;
    background: #ffffff !important;
    min-height: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-header-title,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-header-title {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-header-title h2,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-header-title h2 {
    margin: 0 !important;
    color: #172019 !important;
    font-size: 1.3rem !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.018em !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-header-title .modal-eyebrow,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-header-title .modal-eyebrow {
    display: block !important;
    margin: 4px 0 0 !important;
    color: #66736c !important;
    font-size: 0.84rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button {
    position: absolute !important;
    top: 16px !important;
    right: 20px !important;
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #374151 !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1) !important;
    font-size: 20px !important;
    cursor: pointer !important;
    z-index: 30 !important;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button i,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button i {
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button:hover,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button:hover {
    background: #111827 !important;
    border-color: #111827 !important;
    color: #ffffff !important;
    transform: rotate(90deg) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button:active,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button:active {
    transform: rotate(90deg) scale(0.92) !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button:focus-visible,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button:focus-visible {
    outline: 3px solid rgba(242, 101, 34, 0.24) !important;
    outline-offset: 2px !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog #treatment-form,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) #treatment-form {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-section,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-section {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px 24px 8px 24px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    scrollbar-width: thin !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-section-heading,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-section-heading {
    display: none !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-grid,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field {
    min-width: 0 !important;
    display: grid !important;
    gap: 7px !important;
    margin: 0 !important;
    padding: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field > label,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field > label {
    color: #29332d !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field :is(input:not([type="file"]), textarea),
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field :is(input:not([type="file"]), textarea) {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #172019 !important;
    font: inherit !important;
    font-size: 0.9rem !important;
    transition: border-color 140ms ease, box-shadow 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field :is(input:not([type="file"])),
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field :is(input:not([type="file"])) {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field textarea,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field textarea {
    min-height: 96px !important;
    padding: 10px 12px !important;
    line-height: 1.55 !important;
    resize: vertical !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field :is(input, textarea):focus,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field :is(input, textarea):focus {
    border-color: #355b46 !important;
    box-shadow: 0 0 0 3px rgba(53, 91, 70, 0.12) !important;
    outline: none !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-field input[readonly],
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-field input[readonly] {
    color: #566159 !important;
    background: #f4f7f5 !important;
    border-color: #dce3df !important;
    cursor: default !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .form-hint,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .form-hint {
    margin: 2px 0 0 !important;
    color: #66736c !important;
    font-size: 0.76rem !important;
    line-height: 1.4 !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .form-error,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .form-error {
    margin: 2px 0 0 !important;
    color: #a93636 !important;
    font-size: 0.76rem !important;
    line-height: 1.35 !important;
}

/* Date and Time Fields */
#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-date-field,
#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-time-field,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-date-field,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-time-field {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-date-field .thai-datetime-control.is-date,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-date-field .thai-datetime-control.is-date {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-date-field .thai-datetime-control.is-date .thai-datetime-date-group,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-date-field .thai-datetime-control.is-date .thai-datetime-date-group {
    display: grid !important;
    grid-template-columns: minmax(64px, 0.8fr) minmax(120px, 1.8fr) minmax(88px, 1.1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-time-field .thai-datetime-control.is-time,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-time-field .thai-datetime-control.is-time {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-time-field .thai-datetime-control.is-time .thai-datetime-time-group,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-time-field .thai-datetime-control.is-time .thai-datetime-time-group {
    display: inline-grid !important;
    grid-template-columns: 84px auto 84px auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
}

/* Pill Autocomplete Field & Search Icon */
#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete-control,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete-control {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete-control > i.bi-search,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete-control > i.bi-search {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #7a857d !important;
    font-size: 14px !important;
    pointer-events: none !important;
    z-index: 2 !important;
    transition: opacity 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog #treatment-pill-search,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) #treatment-pill-search {
    width: 100% !important;
    padding-left: 38px !important;
    padding-right: 36px !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete.has-value .pill-autocomplete-control > i.bi-search,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete.has-value .pill-autocomplete-control > i.bi-search {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete.has-value #treatment-pill-search,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete.has-value #treatment-pill-search {
    padding-left: 12px !important;
    padding-right: 36px !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete-clear,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete-clear {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #eef3f0 !important;
    color: #566159 !important;
    font-size: 0.75rem !important;
    cursor: pointer !important;
    z-index: 3 !important;
    transition: all 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .pill-autocomplete-clear:hover,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .pill-autocomplete-clear:hover {
    background: #dfe7e2 !important;
    color: #172019 !important;
}

/* Footer / Action Buttons */
#chicken-modal #chicken-modal-dialog.is-treatment-dialog .edit-form-actions,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .edit-form-actions {
    position: relative !important;
    bottom: auto !important;
    z-index: 10 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    padding: 16px 24px !important;
    margin: 0 !important;
    border-top: 1px solid #eef2ef !important;
    background: #fbfdfc !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-cancel-button,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-cancel-button {
    min-height: 40px !important;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #29332d !important;
    font: inherit !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-cancel-button:hover,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-cancel-button:hover {
    background: #f2f4f3 !important;
    border-color: #bcc5bf !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-save-button.treatment-save-button,
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-save-button.treatment-save-button {
    min-height: 40px !important;
    min-width: 140px !important;
    padding: 0 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    border: 1px solid #183f2c !important;
    border-radius: 8px !important;
    background: #183f2c !important;
    color: #ffffff !important;
    font: inherit !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 140ms ease !important;
}

#chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-save-button.treatment-save-button:hover:not(:disabled),
#chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-save-button.treatment-save-button:hover:not(:disabled) {
    background: #102f20 !important;
    border-color: #102f20 !important;
}

/* Responsive Overrides */
@media (max-width: 620px) {
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium.is-treatment-dialog,
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog:has(#treatment-form:not([hidden])),
    #chicken-modal #chicken-modal-dialog.is-treatment-dialog {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 24px) !important;
        border-radius: 12px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog > .chicken-modal-header,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) > .chicken-modal-header {
        padding: 20px 72px 16px 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-close-button,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-close-button {
        top: 14px !important;
        right: 14px !important;
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        border-radius: 50% !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-section,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-section {
        padding: 16px 18px 8px 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .edit-form-actions,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .edit-form-actions {
        padding: 14px 18px !important;
    }
}

@media (max-width: 480px) {
    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .chicken-form-grid,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .chicken-form-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-date-field .thai-datetime-control.is-date .thai-datetime-date-group,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-date-field .thai-datetime-control.is-date .thai-datetime-date-group {
        grid-template-columns: minmax(58px, 0.7fr) minmax(110px, 1.6fr) minmax(84px, 1fr) !important;
        gap: 6px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .treatment-time-field .thai-datetime-control.is-time .thai-datetime-time-group,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .treatment-time-field .thai-datetime-control.is-time .thai-datetime-time-group {
        grid-template-columns: 74px auto 74px auto !important;
        gap: 6px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .edit-form-actions,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .edit-form-actions {
        flex-direction: column-reverse !important;
        gap: 8px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-cancel-button,
    #chicken-modal #chicken-modal-dialog.is-treatment-dialog .modal-save-button.treatment-save-button,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-cancel-button,
    #chicken-modal #chicken-modal-dialog:has(#treatment-form:not([hidden])) .modal-save-button.treatment-save-button {
        width: 100% !important;
        min-height: 42px !important;
    }
}

#chicken-modal .modal-size-medium textarea {
    min-height: 96px !important;
    max-height: 170px !important;
    resize: vertical !important;
}

#chicken-modal .modal-size-medium .edit-form-actions,
#chicken-modal .modal-size-medium .chicken-form-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;

    display: flex !important;
    width: auto !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;

    margin: 20px -22px -22px !important;
    padding: 14px 22px !important;

    border-top: 1px solid #e3e8e4 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 -8px 22px rgba(23, 41, 31, 0.08) !important;
}

/* is-sick-entry ใช้เฉพาะหน้าตา ไม่สามารถดัน Popup กลับไปเต็มจอ */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium.is-sick-entry {
    width: min(820px, calc(100vw - 40px)) !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(780px, calc(100dvh - 60px)) !important;
}

@media (max-width: 900px) {
    #chicken-modal.chicken-modal:not([hidden]) {
        padding: 12px !important;
    }

    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large {
        width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 24px) !important;
        border-radius: 20px !important;
    }

    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium,
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium.is-sick-entry {
        width: min(760px, calc(100vw - 24px)) !important;
        max-height: calc(100dvh - 24px) !important;
        border-radius: 20px !important;
    }
}

@media (max-width: 640px) {
    #chicken-modal.chicken-modal:not([hidden]) {
        padding: 8px !important;
    }

    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large,
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium,
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-medium.is-sick-entry {
        width: calc(100vw - 16px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 16px !important;
    }

    #chicken-modal .modal-size-medium .chicken-form-grid,
    #chicken-modal .modal-size-medium .edit-form-grid {
        grid-template-columns: 1fr !important;
    }

    #chicken-modal .modal-size-medium .chicken-form-field,
    #chicken-modal .modal-size-medium .edit-form-field,
    #chicken-modal .modal-size-medium .form-field-full,
    #chicken-modal .modal-size-medium .edit-form-full {
        grid-column: 1 !important;
    }

    #chicken-modal .modal-size-medium #edit-health-form:not([hidden]),
    #chicken-modal .modal-size-medium #add-vaccine-form:not([hidden]),
    #chicken-modal .modal-size-medium #add-sick-chicken-form:not([hidden]),
    #chicken-modal .modal-size-medium #health-history-view:not([hidden]) {
        padding: 16px !important;
    }

    #chicken-modal .modal-size-medium .edit-form-actions,
    #chicken-modal .modal-size-medium .chicken-form-actions {
        margin: 18px -16px -16px !important;
        padding: 12px 16px !important;
    }
}
/* ปกติ: วงกลมดำ ไอคอนขาว */
.summary-card-icon,
.summary-all .summary-card-icon,
.summary-father .summary-card-icon,
.summary-mother .summary-card-icon,
.summary-sick .summary-card-icon,
.summary-vaccine .summary-card-icon {
    background: #111111 !important;
    color: #ffffff !important;
    border: none !important;
}

/* ตอนเลือกการ์ด: วงกลมขาว ไอคอนดำ */
.chicken-summary-card.is-active .summary-card-icon {
    background: #ffffff !important;
    color: #111111 !important;
    border: none !important;
}
/* จัดหัวตารางและข้อมูลให้ตรงกัน */
.chicken-table th,
.chicken-table td {
    text-align: center;
}

/* คอลัมน์ข้อมูลไก่ ให้ชิดซ้าย */
.chicken-table th:first-child,
.chicken-table td:first-child {
    text-align: left;
}

/* คอลัมน์จัดการ */
.chicken-table th:last-child,
.chicken-table td:last-child {
    text-align: center;
}
.chicken-table {
    width: 100%;
    table-layout: fixed;
}
.chicken-table th:nth-child(1),
.chicken-table td:nth-child(1) {
    width: 26%;
}

.chicken-table th:nth-child(2),
.chicken-table td:nth-child(2) {
    width: 8%;
}

.chicken-table th:nth-child(3),
.chicken-table td:nth-child(3) {
    width: 11%;
}

.chicken-table th:nth-child(4),
.chicken-table td:nth-child(4) {
    width: 9%;
}

.chicken-table th:nth-child(5),
.chicken-table td:nth-child(5) {
    width: 10%;
}

.chicken-table th:nth-child(6),
.chicken-table td:nth-child(6) {
    width: 10%;
}

.chicken-table th:nth-child(7),
.chicken-table td:nth-child(7) {
    width: 12%;
}

.chicken-table th:nth-child(8),
.chicken-table td:nth-child(8) {
    width: 14%;
}
/* =========================
   ปุ่มจัดการสุขภาพ
   ========================= */

/* บน: ประวัติสุขภาพ - เขียว */
.health-history-action-button {
    background: #1F8A4D !important;
    color: #ffffff !important;
    border: 1px solid #1F8A4D !important;
}

.health-history-action-button:hover {
    background: #176f3d !important;
    border-color: #176f3d !important;
    color: #ffffff !important;
}


/* กลาง: แก้ไขสุขภาพ - เหลืองทอง */
.edit-action-button {
    background: #CA8A04 !important;
    color: #ffffff !important;
    border: 1px solid #CA8A04 !important;
}

.edit-action-button:hover {
    background: #a96f03 !important;
    border-color: #a96f03 !important;
    color: #ffffff !important;
}


/* ล่าง: เพิ่มการรักษา - น้ำเงินทันสมัย */
.treatment-action-button {
    background: #2563EB !important;
    color: #ffffff !important;
    border: 1px solid #2563EB !important;
}

.treatment-action-button:hover {
    background: #1D4ED8 !important;
    border-color: #1D4ED8 !important;
    color: #ffffff !important;
}
/* ปุ่มเพิ่มวัคซีน - เหลืองทันสมัย */
.vaccine-action-button {
    background: #F59E0B !important;
    color: #ffffff !important;
    border: 1px solid #F59E0B !important;
}

.vaccine-action-button:hover {
    background: #D97706 !important;
    border-color: #D97706 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}
/* =========================================
   ปุ่มคำสั่งด้านบน Popup รายละเอียดไก่
   ========================================= */

/* ประกาศขาย - น้ำเงินทันสมัย */
#chicken-modal .modal-header-action-button.action-sell {
    background: #2563EB !important;
    border-color: #2563EB !important;
    color: #ffffff !important;
}

/* แผนผังสายเลือด - เขียว */
#chicken-modal .modal-header-action-button.action-lineage {
    background: #1F8A4D !important;
    border-color: #1F8A4D !important;
    color: #ffffff !important;
}

/* แก้ไขข้อมูลไก่ - เหลืองทอง */
#chicken-modal .modal-header-action-button.action-edit {
    background: #CA8A04 !important;
    border-color: #CA8A04 !important;
    color: #ffffff !important;
}

/* ลบข้อมูลไก่ - แดง */
#chicken-modal .modal-header-action-button.action-delete {
    background: #DC2626 !important;
    border-color: #DC2626 !important;
    color: #ffffff !important;
}
#chicken-modal .modal-header-action-button.action-sell:hover {
    background: #1D4ED8 !important;
    border-color: #1D4ED8 !important;
    color: #ffffff !important;
}

#chicken-modal .modal-header-action-button.action-lineage:hover {
    background: #18733F !important;
    border-color: #18733F !important;
    color: #ffffff !important;
}

#chicken-modal .modal-header-action-button.action-edit:hover {
    background: #A16207 !important;
    border-color: #A16207 !important;
    color: #ffffff !important;
}

#chicken-modal .modal-header-action-button.action-delete:hover {
    background: #B91C1C !important;
    border-color: #B91C1C !important;
    color: #ffffff !important;
}
/* ให้รหัสไก่ + ชื่อไก่อยู่บรรทัดเดียวกัน */
#chicken-modal .showcase-title-row > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chicken-modal .showcase-title-row > div > span {
    margin: 0;
}

#chicken-modal .showcase-title-row h2 {
    margin: 0;
}
#chicken-modal .showcase-fact-grid > div,
#chicken-modal .showcase-lineage-grid > div,
#chicken-modal .showcase-health-panel > div,
#chicken-modal .showcase-vaccine-panel > div {
    background: #ffffff !important;
}
#chicken-modal .showcase-lineage-grid > div:nth-child(1),
#chicken-modal .showcase-lineage-grid > div:nth-child(2),
#chicken-modal .showcase-lineage-grid > div:nth-child(3) {
    background: #ffffff !important;
}
/* พ่อพันธุ์ - น้ำเงิน */
.status-father {
    background: #2563EB !important;
    color: #fff !important;
}

/* แม่พันธุ์ - ชมพู */
.status-mother {
    background: #DB2777 !important;
    color: #fff !important;
}

/* ไก่ทั่วไป - เขียว */
.status-general {
    background: #15803D !important;
    color: #fff !important;
}
#chicken-modal .is-detail-showcase .data-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 30px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;

    border-radius: 999px;
    text-align: center;
}

/* =====================================================
   DETAIL POPUP — MINIMAL PROFILE LAYOUT
   Scoped to detail mode so edit/add/health forms keep their existing UI.
   ===================================================== */
#chicken-modal #chicken-modal-dialog.is-detail-showcase {
    background:#fff !important;
    border:0 !important;
    box-shadow:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-modal-header {
    box-sizing:border-box !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-detail-view:not([hidden]) {
    padding:28px 32px 40px !important;
    background:#fff !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
    display:grid !important;
    grid-template-columns:minmax(0,2fr) minmax(0,3fr) !important;
    gap:32px !important;
    align-items:start !important;
    width:100% !important;
    min-width:0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-sidebar,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-main {
    min-width:0 !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:18px !important;
    background:transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-sidebar {
    position:sticky;
    top:0;
    align-self:start;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-overview-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-record-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card {
    min-width:0 !important;
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image {
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    aspect-ratio:auto !important;
    overflow:visible !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image img {
    display:block !important;
    width:100% !important;
    height:auto !important;
    max-width:100% !important;
    max-height:620px !important;
    object-fit:contain !important;
    object-position:center !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail-grid {
    display:flex !important;
    flex-flow:row nowrap !important;
    align-items:center !important;
    gap:10px !important;
    width:100% !important;
    padding:2px 0 6px !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    scrollbar-width:thin;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail {
    width:76px !important;
    height:76px !important;
    flex:0 0 76px !important;
    padding:2px !important;
    overflow:hidden !important;
    border:1px solid transparent !important;
    border-radius:10px !important;
    background:transparent !important;
    box-shadow:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail:hover,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail.is-active {
    border-color:#24744d !important;
    transform:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail img {
    width:100% !important;
    height:100% !important;
    border-radius:7px !important;
    object-fit:contain !important;
    background:#fff !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card {
    padding:22px 0 0 !important;
    border-top:1px solid #e6ebe7 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card h3 {
    margin:0 0 14px !important;
    color:#25362c !important;
    font-size:.92rem !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history {
    width:100% !important;
    padding:22px 0 0 !important;
    border-top:1px solid #e6ebe7 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history h3 {
    display:flex;
    align-items:center;
    gap:9px;
    margin:0 0 12px !important;
    color:#25362c !important;
    font-size:.92rem !important;
    font-weight:750 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history h3 i {
    color:#c99116 !important;
    font-size:1rem;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px 24px;
    width:100%;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats > div {
    min-width:0;
    display:grid;
    gap:3px;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail > span {
    color:#7a857f;
    font-size:.72rem;
    font-weight:500;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats strong {
    color:#192a20;
    font-size:.94rem;
    font-weight:750;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats small {
    color:#526159;
    font-size:.72rem;
    font-weight:600;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail {
    display:grid;
    gap:6px;
    margin-top:16px;
    padding-top:16px;
    border-top:1px solid #edf0ed;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail > p {
    margin:0 !important;
    padding:0 !important;
    color:#26372d !important;
    background:transparent !important;
    font-size:.86rem !important;
    font-weight:600 !important;
    line-height:1.7 !important;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail > .detail-empty-value {
    color:#7b8780 !important;
    font-weight:500 !important;
}

#chicken-modal .fight-history-section[hidden] {
    display:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card video {
    width:100% !important;
    max-height:300px !important;
    border-radius:8px !important;
    object-fit:contain !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-video-placeholder {
    height:auto !important;
    min-height:104px !important;
    padding:18px 0 !important;
    border:0 !important;
    border-radius:0 !important;
    color:#7b8780 !important;
    background:transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-overview-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card {
    padding:0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row {
    min-width:0 !important;
    padding:2px 0 22px !important;
    align-items:center !important;
    border-bottom:1px solid #e4e9e5 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row > div {
    min-width:0 !important;
    display:flex !important;
    align-items:baseline !important;
    flex-wrap:wrap !important;
    gap:10px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row > div > span {
    flex:0 0 auto !important;
    color:#738079 !important;
    font-size:.78rem !important;
    font-weight:700 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row h2 {
    min-width:0 !important;
    margin:0 !important;
    color:#17271e !important;
    font-size:clamp(1.7rem,3vw,2.45rem) !important;
    font-weight:800 !important;
    line-height:1.15 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-section-title {
    margin:24px 0 16px !important;
    padding:24px 0 0 !important;
    border-top:1px solid #e6ebe7 !important;
    border-bottom:0 !important;
    border-radius:0 !important;
    color:#274333 !important;
    background:transparent !important;
    font-size:.96rem !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row + .showcase-section-title {
    margin-top:22px !important;
    padding-top:0 !important;
    border-top:0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:20px 34px !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    background:transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
    margin-top:20px !important;
    padding-top:20px !important;
    border-top:1px solid #edf0ed !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel > div {
    min-width:0 !important;
    padding:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    border-bottom: none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel span {
    color:#7a857f !important;
    font-size:.73rem !important;
    font-weight:500 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel strong {
    color:#192a20 !important;
    font-size:.91rem !important;
    font-weight:700 !important;
    line-height:1.5 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid small {
    color:#89938d !important;
    font-size:.7rem !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-empty-value {
    padding:8px 0 !important;
    border:0 !important;
    border-radius:0 !important;
    color:#7b8780 !important;
    background:transparent !important;
    text-align:left !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-record-card {
    padding:22px 0 0 !important;
    border-top:1px solid #e6ebe7 !important;
    color:#1d3024 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-record-card span {
    margin:0 0 8px !important;
    color:#6f7d75 !important;
    font-size:.76rem !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-record-card strong {
    color:#1b2d22 !important;
    font-size:.93rem !important;
    font-weight:700 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card {
    padding-top:22px !important;
    border-top:1px solid #e6ebe7 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-accordion {
    padding:0 !important;
    overflow:visible !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-toggle {
    padding:10px 0 !important;
    background:transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-content {
    padding:10px 0 2px 52px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .history-card {
    margin:0 !important;
    padding:14px 0 !important;
    border:0 !important;
    border-bottom:1px solid #edf0ed !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-browser {
    width:100%;
    min-width:0;
    max-width:100%;
    padding:4px 0 0;
    overflow:hidden;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter-bar {
    display:flex;
    flex-flow:row nowrap;
    align-items:center;
    gap:8px;
    width:100%;
    max-width:100%;
    padding:2px 0 8px;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter {
    min-height:34px;
    flex:0 0 auto;
    padding:6px 13px;
    border:1px solid #dce3de;
    border-radius:999px;
    color:#526159;
    background:#fff;
    box-shadow:none;
    font-family:inherit;
    font-size:.73rem;
    font-weight:700;
    line-height:1.2;
    white-space:nowrap;
    cursor:pointer;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter:hover,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter:focus-visible {
    border-color:#78a98d;
    color:#1f6946;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter.is-active {
    border-color:#24744d;
    color:#fff;
    background:#24744d;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range {
    display:flex;
    flex-wrap:wrap;
    align-items:flex-end;
    gap:10px;
    margin:8px 0 18px;
    padding:14px 0 16px;
    border-bottom:1px solid #edf0ed;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range[hidden] {
    display:none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range label {
    min-width:145px;
    flex:1 1 160px;
    display:grid;
    gap:6px;
    color:#6f7d75;
    font-size:.7rem;
    font-weight:600;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range input {
    box-sizing:border-box;
    width:100%;
    min-width:0;
    min-height:38px;
    padding:7px 10px;
    border:1px solid #dce3de;
    border-radius:9px;
    color:#213229;
    background:#fff;
    font-family:inherit;
    font-size:.78rem;
    font-weight:600;
    line-height:1.2;
    outline:none;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range input:focus {
    border-color:#24744d;
    box-shadow:0 0 0 3px rgba(36,116,77,.1);
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range input.has-error {
    border-color:#cf3f3f;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-apply,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-expand {
    min-height:38px;
    padding:8px 15px;
    border:1px solid #24744d;
    border-radius:999px;
    color:#fff;
    background:#24744d;
    box-shadow:none;
    font-family:inherit;
    font-size:.76rem;
    font-weight:700;
    line-height:1.2;
    cursor:pointer;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-error {
    flex:1 0 100%;
    min-height:1em;
    color:#b42318;
    font-size:.7rem;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-result {
    min-width:0;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-result .history-list {
    display:grid;
    gap:0;
    border-top:1px solid #edf0ed;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-expand {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    width:fit-content;
    margin:16px auto 2px;
    border-color:#dce3de;
    color:#24744d;
    background:#fff;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-expand[aria-expanded="true"] i {
    transform:rotate(180deg);
}

@media (max-width:900px) {
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
        grid-template-columns:minmax(0,1fr) !important;
        gap:28px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-sidebar {
        position:static !important;
        grid-template-columns:minmax(0,1fr) !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image {
        width:min(100%,640px) !important;
        margin-inline:auto !important;
        aspect-ratio:auto !important;
    }
}

@media (max-width:640px) {
    #chicken-modal #chicken-modal-dialog.is-detail-showcase {
        width:calc(100vw - 32px) !important;
        max-width:calc(100vw - 32px) !important;
        box-sizing:border-box !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-modal-header {
        flex-wrap:wrap !important;
        align-items:center !important;
        padding:12px 16px !important;
        gap:12px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .modal-header-title {
        flex:1 1 calc(100% - 54px) !important;
        width:auto !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .modal-close-button {
        order:2 !important;
        margin:0 !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .modal-header-actions:not([hidden]) {
        order:3 !important;
        flex:1 0 100% !important;
        width:100% !important;
        margin:0 !important;
        display:grid !important;
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
        gap:8px !important;
        overflow:visible !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .modal-header-action-button {
        width:100% !important;
        min-width:0 !important;
        min-height:38px !important;
        padding:0 8px !important;
        font-size:.7rem !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-detail-view:not([hidden]) {
        padding:18px 16px 30px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
        gap:24px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
        grid-template-columns:minmax(0,1fr) !important;
        gap:16px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-title-row {
        align-items:flex-start !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail {
        width:66px !important;
        height:66px !important;
        flex-basis:66px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-content {
        padding-left:0 !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-filter-bar {
        padding-bottom:10px;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range {
        align-items:stretch;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-date-range label {
        min-width:min(100%,145px);
        flex-basis:100%;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-history-apply {
        width:100%;
    }
}
/* ประวัติสุขภาพ - เขียวทันสมัย */
#chicken-modal
.health-history-accordion:not(.vaccine-history-accordion)
.health-history-toggle-left > i {
    background: #1F8A4D !important;
    color: #ffffff !important;
}

/* ประวัติวัคซีน - เหลืองทองทันสมัย */
#chicken-modal
.vaccine-history-accordion
.health-history-toggle-left > i {
    background: #CA8A04 !important;
    color: #ffffff !important;
}

/* =====================================================
   CHICKENS PAGE MODERN SAAS SCOPED REFINEMENT
   (Layout, Summary Cards, Filter Toolbar, Table & Responsive)
   ===================================================== */

/* 1. Page Shell & Responsive Containment */
.dashboard-main.chickens-page {
    width: auto;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    box-sizing: border-box;
}

.chickens-page .chicken-list-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    box-sizing: border-box;
}

/* 2. Summary Cards: Balanced 5-Column Responsive Grid */
.chickens-page .chicken-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-summary-card {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    min-height: 86px !important;
    padding: 14px 16px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    text-align: left !important;
    cursor: pointer !important;
    transition:
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease !important;
}

.chickens-page .chicken-summary-card:hover {
    transform: translateY(-2px) !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
}

.chickens-page .chicken-summary-card.is-active {
    background: #17653d !important;
    border-color: #17653d !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(23, 101, 61, 0.22) !important;
}

.chickens-page .chicken-summary-card .summary-card-icon {
    display: grid !important;
    place-items: center !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 12px !important;
    font-size: 20px !important;
    background: transparent !important;
    color: transparent !important;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease !important;
    flex-shrink: 0 !important;
}

.chickens-page .chicken-summary-card.is-active .summary-card-icon {
    background:  transparent !important;
    color: #ffffff !important;
}

.chickens-page .chicken-summary-card .summary-card-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.chickens-page .chicken-summary-card .summary-card-label {
    margin: 0 !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    color: #64748b !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.chickens-page .chicken-summary-card.is-active .summary-card-label {
    color: rgba(255, 255, 255, 0.85) !important;
}

.chickens-page .chicken-summary-card .summary-card-content strong {
    margin: 0 !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #0f172a !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 4px !important;
}

.chickens-page .chicken-summary-card.is-active .summary-card-content strong {
    color: #ffffff !important;
}

.chickens-page .chicken-summary-card .summary-card-content small {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: #94a3b8 !important;
}

.chickens-page .chicken-summary-card.is-active .summary-card-content small {
    color: rgba(255, 255, 255, 0.75) !important;
}

.chickens-page .chicken-summary-card .summary-card-arrow {
    display: none !important;
}



/* 4. Chicken inventory — restrained, image-led record table */
.chickens-page .chicken-record-shell,
.chickens-page #chicken-table-shell {
    --record-columns: minmax(220px, 2fr) minmax(64px, 0.6fr) minmax(104px, 0.9fr) minmax(76px, 0.68fr) minmax(88px, 0.75fr) minmax(92px, 0.82fr) minmax(104px, 0.9fr) minmax(118px, auto);
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border: 1px solid #e3e9e5 !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    margin-bottom: 24px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-record-header {
    display: grid !important;
    grid-template-columns: var(--record-columns) !important;
    align-items: center !important;
    min-height: 50px !important;
    padding: 0 18px !important;
    background: #fbfcfb !important;
    border-bottom: 1px solid #e7ebe8 !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-record-header > span {
    min-width: 0 !important;
    padding-right: 12px !important;
    color: #5f6963 !important;
    font-size: 0.76rem !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
    white-space: nowrap !important;
}

.chickens-page .chicken-record-header > span:last-child {
    padding-right: 0 !important;
    text-align: center !important;
}

.chickens-page .chicken-record-list {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-record {
    display: grid !important;
    grid-template-columns: var(--record-columns) !important;
    align-items: center !important;
    min-height: 94px !important;
    padding: 12px 18px !important;
    border: 0 !important;
    border-bottom: 1px solid #edf0ee !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    transition: background-color 150ms ease !important;
}

.chickens-page .chicken-record:last-child {
    border-bottom: 0 !important;
}

.chickens-page .chicken-record:hover {
    background: #fafbfa !important;
    box-shadow: none !important;
    transform: none !important;
}

.chickens-page .chicken-record-group {
    display: contents !important;
}

.chickens-page .chicken-record-cell,
.chickens-page .chicken-record-actions {
    min-width: 0 !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-record-cell-label {
    display: none !important;
}

.chickens-page .chicken-record-cell-value {
    min-width: 0 !important;
    color: #26302a !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere !important;
}

.chickens-page .chicken-record-identity-cell {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

.chickens-page .chicken-record-media {
    flex: 0 0 104px !important;
    width: 104px !important;
    height: 68px !important;
    aspect-ratio: 26 / 17 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f1f3f1 !important;
    border: 0 !important;
    box-sizing: border-box !important;
}

.chickens-page .chicken-record-media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.chickens-page .chicken-record-identity {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
}

.chickens-page .chicken-record-code {
    font-size: 0.76rem !important;
    font-weight: 400 !important;
    color: #737d77 !important;
    line-height: 1.35 !important;
    font-variant-numeric: tabular-nums !important;
}

.chickens-page .chicken-record-name {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #172019 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
}

.chickens-page .chicken-record-facts {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    align-items: center !important;
    gap: 12px 18px !important;
    min-width: 0 !important;
}

.chickens-page .chicken-record-fact {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px !important;
}

.chickens-page .chicken-record-fact-label {
    font-size: 0.72rem !important;
    font-weight: 500 !important;
    color: #7a857e !important;
    line-height: 1.35 !important;
}

.chickens-page .chicken-record-fact-value {
    display: flex !important;
    align-items: center !important;
}

.chickens-page .chicken-record-fact-wide {
    min-width: 0 !important;
    max-width: none !important;
}

.chickens-page .chicken-record-text {
    font-size: 0.8125rem !important;
    color: #334155 !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
}

.chickens-page .chicken-record-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-right: 0 !important;
}

.chickens-page .chicken-record-actions .row-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.chickens-page .chicken-record-actions .stacked-actions {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.chickens-page .chicken-record-age .chicken-record-cell-value,
.chickens-page .chicken-record-weight .chicken-record-cell-value {
    font-variant-numeric: tabular-nums !important;
}

.chickens-page #chicken-table-shell[data-mode="sick"] .chicken-record-header,
.chickens-page #chicken-table-shell[data-mode="vaccine"] .chicken-record-header,
.chickens-page #chicken-table-shell[data-mode="sick"] .chicken-record,
.chickens-page #chicken-table-shell[data-mode="vaccine"] .chicken-record {
    grid-template-columns: minmax(220px, 1.15fr) minmax(0, 2.2fr) minmax(150px, auto) !important;
}

/* Legacy Table Compatibility */
.chickens-page .chicken-table {
    width: 100% !important;
    min-width: 920px !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
}

.chickens-page .chicken-table th {
    padding: 14px 16px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    white-space: nowrap !important;
    text-align: center !important;
}

.chickens-page .chicken-table th:first-child {
    text-align: left !important;
}

.chickens-page .chicken-table td {
    padding: 12px 16px !important;
    font-size: 0.875rem !important;
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
    text-align: center !important;
    background: transparent !important;
}

.chickens-page .chicken-table td:first-child {
    text-align: left !important;
    padding: 12px 16px !important;
    border-radius: 0 !important;
}

.chickens-page .chicken-table tbody tr:hover td {
    background: #f8fafc !important;
}

/* 5. Chicken Identity & 1:1 Image Ratio */
.chickens-page .chicken-identity {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 200px !important;
}

.chickens-page .chicken-identity img {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 10px !important;
    border: 1px solid #e2e8f0 !important;
    background: #f1f5f9 !important;
    flex-shrink: 0 !important;
}

.chickens-page .chicken-identity strong {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
}

.chickens-page .chicken-identity span {
    font-size: 0.78rem !important;
    color: #64748b !important;
    line-height: 1.3 !important;
}

/* 6. Action Buttons in Table: Touch Target >= 44px */
.chickens-page .row-action-button,
.chickens-page .detail-action-button {
    min-height: 40px !important;
    min-width: 44px !important;
    padding: 0 14px !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    border: 1px solid #d8ded9 !important;
    background: #ffffff !important;
    color: #234c34 !important;
    box-shadow: none !important;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease !important;
}

.chickens-page .detail-action-button:hover {
    background: #f4f7f5 !important;
    border-color: #aeb9b1 !important;
    color: #183f2c !important;
    transform: none !important;
}

.chickens-page .row-action-button:focus-visible {
    outline: 3px solid rgba(24, 63, 44, 0.28) !important;
    outline-offset: 2px !important;
}

/* 7. Status Badges: Soft Modern Tonal */
.chickens-page .data-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 28px !important;
    padding: 3px 10px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
}

.chickens-page .status-success {
    background: #edf7f0 !important;
    color: #2d6542 !important;
}

.chickens-page .status-treatment,
.chickens-page .status-upcoming,
.chickens-page .status-due {
    background: #fff4df !important;
    color: #875d17 !important;
}

.chickens-page .status-critical,
.chickens-page .status-overdue {
    background: #fbecec !important;
    color: #9b4141 !important;
}

.chickens-page .status-father {
    background: #eef4fb !important;
    color: #46698a !important;
}

.chickens-page .status-mother {
    background: #faeff3 !important;
    color: #8c5368 !important;
}

.chickens-page .status-general {
    background: #f0f4f1 !important;
    color: #56665d !important;
}

/* 8. Responsive Breakpoints */
@media (max-width: 1100px) {
    .chickens-page .chicken-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .chickens-page .chicken-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .chickens-page .chicken-filter-panel {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .chickens-page .dashboard-filter-search-slot {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    .chickens-page .dashboard-filter-capsule-field {
        max-width: 100% !important;
        width: 100% !important;
    }

    .chickens-page .clear-filter-button {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    /* Mobile Table to Card conversion */
    .chickens-page .chicken-table-shell {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    .chickens-page .chicken-table {
        min-width: 0 !important;
    }

    .chickens-page .chicken-table thead {
        display: none !important;
    }

    .chickens-page .chicken-table tbody {
        display: grid !important;
        gap: 12px !important;
    }

    .chickens-page .chicken-table tbody tr {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0 !important;
        padding: 16px !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 16px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    }

    .chickens-page .chicken-table td {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 8px 10px !important;
        border: none !important;
        text-align: left !important;
    }

    .chickens-page .chicken-table td::before {
        content: attr(data-label) !important;
        color: #64748b !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
    }

    .chickens-page .chicken-table td.chicken-name-cell,
    .chickens-page .chicken-table td.action-cell {
        grid-column: 1 / -1 !important;
    }

    .chickens-page .chicken-table td.chicken-name-cell {
        padding-bottom: 12px !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    .chickens-page .chicken-table td.chicken-name-cell::before,
    .chickens-page .chicken-table td.action-cell::before {
        display: none !important;
    }

    .chickens-page .chicken-table td.action-cell {
        padding-top: 12px !important;
        border-top: 1px solid #f1f5f9 !important;
    }

    .chickens-page .row-action-button,
    .chickens-page .detail-action-button {
        width: 100% !important;
    }
}

@media (max-width: 1199px) {
    .chickens-page .chicken-record-header {
        display: none !important;
    }

    .chickens-page .chicken-record {
        display: grid !important;
        grid-template-columns: minmax(190px, 1.35fr) minmax(96px, 0.72fr) minmax(96px, 0.72fr) minmax(112px, 0.8fr) minmax(110px, auto) !important;
        gap: 16px !important;
        min-height: 104px !important;
        padding: 14px 16px !important;
    }

    .chickens-page .chicken-record-general .chicken-record-group {
        display: grid !important;
        align-content: center !important;
        gap: 7px !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell {
        padding-right: 0 !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell:not(.chicken-record-identity-cell) {
        display: grid !important;
        grid-template-columns: minmax(42px, auto) minmax(0, 1fr) !important;
        align-items: baseline !important;
        gap: 6px !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell-label {
        display: inline !important;
        color: #7a857e !important;
        font-size: 0.7rem !important;
        font-weight: 500 !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell-value {
        font-size: 0.82rem !important;
    }

    .chickens-page .chicken-record-actions {
        width: auto !important;
    }

    .chickens-page #chicken-table-shell[data-mode="sick"] .chicken-record,
    .chickens-page #chicken-table-shell[data-mode="vaccine"] .chicken-record {
        grid-template-columns: minmax(190px, 1fr) minmax(0, 1.5fr) minmax(150px, auto) !important;
    }

    .chickens-page #chicken-table-shell[data-mode="sick"] .chicken-record-facts,
    .chickens-page #chicken-table-shell[data-mode="vaccine"] .chicken-record-facts {
        grid-template-columns: repeat(2, minmax(100px, 1fr)) !important;
    }
}

@media (max-width: 720px) {
    .chickens-page .chicken-record-shell,
    .chickens-page #chicken-table-shell {
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .chickens-page .chicken-record-list {
        display: grid !important;
        gap: 12px !important;
    }

    .chickens-page .chicken-record,
    .chickens-page #chicken-table-shell[data-mode="sick"] .chicken-record,
    .chickens-page #chicken-table-shell[data-mode="vaccine"] .chicken-record {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px 16px !important;
        min-height: 0 !important;
        padding: 14px !important;
        border: 1px solid #e3e9e5 !important;
        border-radius: 14px !important;
        background: #ffffff !important;
    }

    .chickens-page .chicken-record-identity-cell,
    .chickens-page .chicken-record-facts,
    .chickens-page .chicken-record-actions {
        grid-column: 1 / -1 !important;
    }

    .chickens-page .chicken-record-media {
        flex-basis: 92px !important;
        width: 92px !important;
        height: 62px !important;
    }

    .chickens-page .chicken-record-general .chicken-record-group {
        display: contents !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell:not(.chicken-record-identity-cell) {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 3px !important;
        padding: 0 !important;
    }

    .chickens-page .chicken-record-general .chicken-record-cell-label {
        display: inline !important;
        color: #7a857e !important;
        font-size: 0.7rem !important;
        font-weight: 500 !important;
    }

    .chickens-page .chicken-record-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        padding-top: 10px !important;
        border-top: 1px solid #edf0ee !important;
    }

    .chickens-page .chicken-record-actions {
        width: 100% !important;
        padding-top: 12px !important;
        border-top: 1px solid #edf0ee !important;
    }

    .chickens-page .chicken-record-actions .row-actions,
    .chickens-page .chicken-record-actions .stacked-actions {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
        width: 100% !important;
    }

    .chickens-page .chicken-record-actions .row-action-button {
        width: 100% !important;
        min-height: 44px !important;
    }
}

@media (max-width: 380px) {
    .chickens-page .chicken-record-actions .row-actions,
    .chickens-page .chicken-record-actions .stacked-actions {
        grid-template-columns: 1fr !important;
    }
}

/* =====================================================
   CHICKENS PAGE MODERN SAAS MICRO-INTERACTIONS & MOTION
   ===================================================== */

/* 1. Summary Cards Motion */
.chickens-page .chicken-summary-card {
    transition:
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        color 160ms ease !important;
}

.chickens-page .chicken-summary-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
}

.chickens-page .chicken-summary-card:active {
    transform: translateY(0) scale(0.99) !important;
}

.chickens-page .chicken-summary-card .summary-card-icon {
    transition:
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
        background-color 160ms ease,
        color 160ms ease !important;
}

.chickens-page .chicken-summary-card:hover .summary-card-icon {
    transform: scale(1.05) !important;
}

/* 2. Filter & Dropdowns Motion */
.chickens-page .custom-dropdown-toggle {
    transition:
        border-color 140ms ease,
        background-color 140ms ease,
        box-shadow 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chickens-page .custom-dropdown-toggle:hover {
    transform: translateY(-1px) !important;
    border-color: #94a3b8 !important;
}

.chickens-page .custom-dropdown-toggle:active {
    transform: translateY(0) scale(0.99) !important;
}

.chickens-page .custom-dropdown-chevron {
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chickens-page [data-custom-dropdown].is-open .custom-dropdown-chevron {
    transform: rotate(180deg) !important;
}

.chickens-page .custom-dropdown-menu {
    opacity: 0;
    transform: translateY(-4px);
    transition:
        opacity 160ms ease-out,
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1) !important;
    will-change: opacity, transform;
}

.chickens-page [data-custom-dropdown].is-open .custom-dropdown-menu:not([hidden]) {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.chickens-page .custom-dropdown-option {
    transition: background-color 120ms ease, color 120ms ease !important;
}

/* 3. Search & Form Inputs Motion */
.chickens-page .dashboard-filter-search {
    transition:
        width 200ms cubic-bezier(0.16, 1, 0.3, 1),
        background-color 160ms ease,
        box-shadow 160ms ease,
        border-color 160ms ease !important;
}

.chickens-page .dashboard-filter-search-slot .dashboard-filter-search-input,
.chickens-page #chicken-search-input,
.chickens-page input,
.chickens-page select,
.chickens-page textarea {
    transition:
        border-color 140ms ease,
        box-shadow 140ms ease,
        background-color 140ms ease,
        opacity 140ms ease,
        transform 140ms ease !important;
}

.chickens-page input:focus,
.chickens-page select:focus,
.chickens-page textarea:focus {
    border-color: #17653d !important;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, 0.15) !important;
}

.chickens-page .clear-filter-button {
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 140ms ease !important;
}

.chickens-page .clear-filter-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

.chickens-page .clear-filter-button:active {
    transform: translateY(0) scale(0.98) !important;
}

/* 4. Table & Action Buttons Motion */
.chickens-page .chicken-table tbody tr td {
    transition: background-color 140ms ease !important;
}

.chickens-page .row-action-button,
.chickens-page .detail-action-button {
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease !important;
}

.chickens-page .detail-action-button:hover {
    background-color: #f4f7f5 !important;
    border-color: #aeb9b1 !important;
    color: #183f2c !important;
    transform: none !important;
    box-shadow: none !important;
}

.chickens-page .detail-action-button:active {
    transform: none !important;
    box-shadow: none !important;
}

.chickens-page .data-badge {
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease !important;
}

/* 5. Pagination Motion */
.chicken-pagination .pagination-navigation {
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chicken-pagination .pagination-navigation:not(:disabled):hover {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
}

.chicken-pagination .pagination-navigation:not(:disabled):active {
    transform: translateY(0) scale(0.97) !important;
}

.chicken-pagination .pagination-page {
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chicken-pagination .pagination-page:hover:not(.active) {
    background-color: #f1f5f9 !important;
    transform: translateY(-1px) !important;
}

.chicken-pagination .pagination-page.active {
    transform: none !important;
}

/* 6. Modal Backdrop & Dialog Transitions */
.chicken-modal {
    opacity: 0;
    transition: opacity 180ms ease-out !important;
}

.chicken-modal.show {
    opacity: 1 !important;
}

.chicken-modal-backdrop {
    opacity: 0;
    transition: opacity 180ms ease-out !important;
}

.chicken-modal.show .chicken-modal-backdrop {
    opacity: 1 !important;
}

.chicken-modal-dialog {
    opacity: 0 !important;
    transform: scale(0.98) translateY(8px) !important;
    transition:
        opacity 180ms ease-out,
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1) !important;
    will-change: opacity, transform;
}

.chicken-modal.show .chicken-modal-dialog {
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
}

.modal-close-button {
    transition:
        background-color 140ms ease,
        color 140ms ease,
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.modal-close-button:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    transform: rotate(90deg) !important;
}

.modal-close-button:active {
    transform: rotate(90deg) scale(0.92) !important;
}

/* 7. Media & Thumbnails Motion */
.showcase-thumbnail {
    transition:
        border-color 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 140ms ease !important;
}

.showcase-thumbnail:hover {
    transform: translateY(-1px) !important;
    border-color: #94a3b8 !important;
}

.showcase-thumbnail.is-active {
    border-color: #17653d !important;
    box-shadow: 0 0 0 2px rgba(23, 101, 61, 0.25) !important;
}

.image-add-tile {
    transition:
        border-color 140ms ease,
        background-color 140ms ease,
        color 140ms ease,
        transform 140ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.image-add-tile:hover {
    border-color: #17653d !important;
    color: #17653d !important;
    background: #f0fdf4 !important;
    transform: translateY(-1px) !important;
}

.image-add-tile:active {
    transform: translateY(0) scale(0.97) !important;
}

/* 8. Empty State Micro-interaction */
.chicken-empty-state span i {
    display: inline-block !important;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chicken-empty-state:hover span i {
    transform: scale(1.08) rotate(3deg) !important;
}



.chickens-page .lineage-autocomplete-option.is-active {
    color: #174f32;
    background: #eef8f2;
}

/* =====================================================
   ADD CHICKEN MODAL — approved Master Modal alignment
   Scoped to add mode so detail/edit and cost modal stay untouched.
   ===================================================== */
.chicken-modal.is-add-mode {
    padding: 16px !important;
    --add-modal-green: #183f2c;
    --add-modal-text: #202923;
    --add-modal-muted: #66736c;
    --add-modal-border: #d5dcd7;
    --add-modal-soft-border: #e7ece8;
    --add-modal-error: #b42318;
}

.chicken-modal.is-add-mode .chicken-modal-backdrop {
    background: rgba(9, 15, 11, 0.52) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#chicken-modal.is-add-mode #chicken-modal-dialog.chicken-modal-dialog.is-add-entry {
    position: relative !important;
    inset: auto !important;
    width: min(720px, calc(100vw - 32px)) !important;
    max-width: 720px !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: 90dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    overscroll-behavior: contain;
    color: var(--add-modal-text);
    background: #ffffff !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1) !important;
}

#chicken-modal.is-add-mode .is-add-entry .chicken-modal-header {
    position: relative !important;
    inset: auto !important;
    z-index: 3 !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 24px 76px 18px 24px !important;
    display: block !important;
    background: #ffffff !important;
    border: 0 !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-header-title {
    min-width: 0 !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-header-title h2 {
    margin: 0 !important;
    color: var(--add-modal-text) !important;
    font-size: 1.3rem !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.015em !important;
    text-wrap: balance;
}

#chicken-modal.is-add-mode .is-add-entry .modal-eyebrow {
    display: block !important;
    max-width: 65ch;
    margin: 4px 0 0 !important;
    color: var(--add-modal-muted) !important;
    font-size: 0.82rem !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-header-actions {
    display: none !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-close-button {
    position: absolute !important;
    top: 16px !important;
    right: 20px !important;
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #374151 !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1) !important;
    font-size: 20px !important;
    cursor: pointer !important;
    z-index: 30 !important;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 140ms ease !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-close-button i {
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-close-button:hover {
    background: #111827 !important;
    border-color: #111827 !important;
    color: #ffffff !important;
    transform: rotate(90deg) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-close-button:active {
    transform: rotate(90deg) scale(0.92) !important;
}

#chicken-modal.is-add-mode .is-add-entry .modal-close-button:focus-visible {
    outline: 3px solid rgba(242, 101, 34, 0.24) !important;
    outline-offset: 2px !important;
}

#chicken-modal.is-add-mode #add-chicken-form:not([hidden]) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: #ffffff !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 24px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #aab4ad #f4f6f5;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-body::-webkit-scrollbar {
    width: 9px;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-body::-webkit-scrollbar-track {
    background: #f4f6f5;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-body::-webkit-scrollbar-thumb {
    background: #aab4ad;
    border: 2px solid #f4f6f5;
    border-radius: 999px;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section {
    margin: 0 !important;
    padding: 20px 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section:first-child {
    padding-top: 8px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section + .chicken-form-section {
    border-top: 1px solid var(--add-modal-soft-border) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section-heading {
    display: block !important;
    margin: 0 0 13px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section-heading > span {
    display: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section-heading h3 {
    margin: 0 !important;
    color: var(--add-modal-text) !important;
    font-size: 0.86rem !important;
    font-weight: 650 !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-section-heading p {
    margin: 3px 0 0 !important;
    color: var(--add-modal-muted) !important;
    font-size: 0.75rem !important;
    line-height: 1.5 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .fight-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .form-field-full {
    grid-column: 1 / -1 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field {
    gap: 6px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field label {
    color: #3e4b43 !important;
    font-size: 0.82rem !important;
    font-weight: 550 !important;
    line-height: 1.45 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field label span {
    color: #b42318 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field input:not([type="file"]),
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field select,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field textarea {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    color: #202923 !important;
    background: #ffffff !important;
    border: 1px solid var(--add-modal-border) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 0.86rem !important;
    line-height: 1.45 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field textarea {
    height: auto !important;
    min-height: 88px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    resize: vertical;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field input[readonly] {
    color: #647168 !important;
    background: #f4f6f5 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field input:not([type="file"]):hover,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field select:hover,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field textarea:hover {
    border-color: #aeb9b1 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field input:not([type="file"]):focus,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field select:focus,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field textarea:focus {
    border-color: #567563 !important;
    outline: 3px solid rgba(24, 63, 44, 0.12) !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .invalid,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field [aria-invalid="true"] {
    background: #fffafa !important;
    border-color: #c94b40 !important;
    outline-color: rgba(180, 35, 24, 0.1) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .form-hint,
#chicken-modal.is-add-mode #add-chicken-form .form-error {
    font-size: 0.72rem !important;
    line-height: 1.45 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .form-hint {
    color: var(--add-modal-muted) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .form-error {
    color: var(--add-modal-error) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-code-note {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 12px 0 0;
    color: var(--add-modal-muted);
    font-size: 0.74rem;
    line-height: 1.5;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-code-note i {
    color: #476957;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control > i {
    position: absolute !important;
    top: 50% !important;
    left: 12px !important;
    transform: translateY(-50%) !important;
    font-size: 15px !important;
    line-height: 1 !important;
    color: #77837b !important;
    pointer-events: none !important;
    z-index: 2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: opacity 0.15s ease, visibility 0.15s ease !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control.has-value > i,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control.is-filled > i,
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control:has(input[type="text"]:not(:placeholder-shown)) > i {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control input:not([type="file"]),
#chicken-modal.is-add-mode #add-chicken-form .chicken-form-field .lineage-autocomplete-control input {
    padding-left: 36px !important;
    padding-right: 12px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .lineage-autocomplete-menu {
    z-index: 260 !important;
    max-height: min(220px, 32dvh) !important;
    padding: 6px !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 1px solid var(--add-modal-border) !important;
    border-radius: 8px !important;
    box-shadow: 0 14px 28px rgba(15, 28, 20, 0.14) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .lineage-autocomplete-menu.opens-upward {
    top: auto !important;
    bottom: calc(100% + 6px) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .lineage-autocomplete-option {
    min-height: 44px;
    padding: 8px 10px !important;
    border-radius: 6px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .media-image-manager {
    width: 100% !important;
    margin-top: 2px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .media-main-image-preview {
    display: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .media-thumbnail-strip,
#chicken-modal.is-add-mode #add-chicken-form .media-thumbnail-strip .image-preview-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 0 !important;
}

#chicken-modal.is-add-mode #add-chicken-form .managed-image-thumbnail,
#chicken-modal.is-add-mode #add-chicken-form .image-add-tile {
    flex: 0 0 96px !important;
    width: 96px !important;
    height: 96px !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #f6f8f6 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .managed-image-thumbnail {
    border: 1px solid var(--add-modal-border) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .managed-image-thumbnail.is-primary {
    border-color: #527461 !important;
    outline: 2px solid rgba(24, 63, 44, 0.15) !important;
    outline-offset: 1px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .image-add-tile {
    display: grid !important;
    place-items: center !important;
    align-content: center !important;
    gap: 5px !important;
    color: #355b46 !important;
    border: 1px dashed #aebbb2 !important;
    cursor: pointer;
}

#chicken-modal.is-add-mode #add-chicken-form .image-add-tile:hover {
    color: #183f2c !important;
    background: #eef4f0 !important;
    border-color: #6f8879 !important;
    transform: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .image-add-tile:focus-visible,
#chicken-modal.is-add-mode #add-chicken-form .managed-image-actions button:focus-visible {
    outline: 3px solid rgba(24, 63, 44, 0.18) !important;
    outline-offset: 2px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .managed-image-actions {
    right: 3px !important;
    bottom: 3px !important;
    gap: 3px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .managed-image-actions button {
    width: 44px !important;
    height: 44px !important;
    border-radius: 7px !important;
    transform: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .thumbnail-primary-badge {
    top: 5px !important;
    left: 5px !important;
    width: 24px !important;
    height: 24px !important;
    box-shadow: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker {
    width: 100%;
    min-height: 76px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    color: #34433a;
    text-align: left;
    background: #fafbfa;
    border: 1px dashed #aebbb2;
    border-radius: 8px;
    cursor: pointer;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker:hover {
    background: #f4f7f5;
    border-color: #6f8879;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker:focus-visible {
    outline: 3px solid rgba(24, 63, 44, 0.18);
    outline-offset: 2px;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #355b46;
    background: #edf3ef;
    border-radius: 8px;
    font-size: 1rem;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker-copy strong {
    font-size: 0.82rem;
    font-weight: 600;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker-copy small {
    color: var(--add-modal-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-picker-action {
    min-height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    color: #294e39;
    background: #ffffff;
    border: 1px solid var(--add-modal-border);
    border-radius: 7px;
    font-size: 0.76rem;
    font-weight: 600;
}

#chicken-modal.is-add-mode #add-chicken-form .video-preview {
    min-height: 58px !important;
    margin-top: 4px !important;
    padding: 9px 10px !important;
    display: grid !important;
    grid-template-columns: 36px minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    background: #f7f9f7 !important;
    border: 1px solid var(--add-modal-soft-border) !important;
    border-radius: 8px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .video-preview[hidden] {
    display: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-preview-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: #355b46;
    background: #eaf1ec;
    border-radius: 7px;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-preview-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-preview-copy strong {
    overflow: hidden;
    color: #2d3932;
    font-size: 0.78rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chicken-modal.is-add-mode #add-chicken-form .add-video-preview-copy span {
    color: var(--add-modal-muted);
    font-size: 0.7rem;
}

#chicken-modal.is-add-mode #add-chicken-form .video-preview .edit-media-danger-button {
    min-width: 44px;
    min-height: 40px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #a6382f;
    background: #ffffff;
    border: 1px solid #e1c0bd;
    border-radius: 7px;
    cursor: pointer;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions {
    position: relative !important;
    inset: auto !important;
    z-index: 3 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 20px 24px 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 9px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--add-modal-soft-border) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-cancel-button,
#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-save-button {
    min-width: 0 !important;
    min-height: 40px !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    transform: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-cancel-button {
    color: #34433a !important;
    background: #ffffff !important;
    border: 1px solid var(--add-modal-border) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-save-button {
    color: #ffffff !important;
    background: var(--add-modal-green) !important;
    border: 1px solid var(--add-modal-green) !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions button:hover:not(:disabled) {
    filter: brightness(0.96);
    transform: none !important;
}

#chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions button:focus-visible {
    outline: 3px solid rgba(24, 63, 44, 0.18) !important;
    outline-offset: 2px !important;
}

#chicken-modal.is-add-mode #add-chicken-form .modal-save-button[aria-busy="true"]::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: add-chicken-spinner 700ms linear infinite;
}

#chicken-modal.is-add-mode #add-chicken-form button:disabled {
    cursor: not-allowed !important;
    opacity: 0.66 !important;
}

@keyframes add-chicken-spinner {
    to { transform: rotate(360deg); }
}

@media (max-width: 620px) {
    .chicken-modal.is-add-mode {
        padding: 12px !important;
    }

    #chicken-modal.is-add-mode #chicken-modal-dialog.chicken-modal-dialog.is-add-entry {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 24px) !important;
    }

    #chicken-modal.is-add-mode .is-add-entry .chicken-modal-header {
        padding: 20px 72px 15px 18px !important;
    }

    #chicken-modal.is-add-mode .is-add-entry .modal-close-button {
        top: 14px !important;
        right: 14px !important;
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        border-radius: 50% !important;
    }

    #chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-body {
        padding: 0 18px 20px !important;
    }

    #chicken-modal.is-add-mode #add-chicken-form .chicken-form-section {
        padding: 18px 0 !important;
    }

    #chicken-modal.is-add-mode #add-chicken-form .chicken-form-grid,
    #chicken-modal.is-add-mode #add-chicken-form .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
    }

    #chicken-modal.is-add-mode #add-chicken-form .add-video-picker {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    #chicken-modal.is-add-mode #add-chicken-form .add-video-picker-action {
        grid-column: 1 / -1;
        min-height: 40px;
        justify-content: center;
    }

    #chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        flex-direction: row !important;
        padding: 14px 18px 18px !important;
    }

    #chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-cancel-button,
    #chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions .modal-save-button {
        width: 100% !important;
        min-height: 44px !important;
    }
}

@media (max-width: 380px) {
    #chicken-modal.is-add-mode #add-chicken-form .add-chicken-form-actions button {
        padding-right: 10px !important;
        padding-left: 10px !important;
    }
}

/* 9. Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
        transform: none !important;
    }
}
/* =========================
   ต้นทุนไก่ — table ชิดขอบ
   ========================= */

/* กล่องครอบตาราง */
.cost-table-wrap {
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
    overflow-x: auto;
}

/* ตารางหลัก */
.cost-table {
    width: 100% !important;
    border-collapse: collapse;
    table-layout: fixed;
    border-left: none !important;
    border-right: none !important;
}

/* หัวตาราง + เนื้อหา */
.cost-table th,
.cost-table td {
    border-left: none !important;
    border-right: none !important;
    vertical-align: middle;
}

/* หัวคอลัมน์ข้อมูลไก่ ชิดซ้าย */
.cost-table th:first-child,
.cost-table td:first-child {
    text-align: left;
    padding-left: 16px !important;
}

/* หัวคอลัมน์จัดการ ชิดขวา */
.cost-table th:last-child,
.cost-table td:last-child {
    text-align: right;
    padding-right: 16px !important;
}

/* คอลัมน์ตรงกลาง */
.cost-table th:not(:first-child):not(:last-child),
.cost-table td:not(:first-child):not(:last-child) {
    text-align: center;
}

/* กันไม่ให้คอลัมน์จัดการกว้างเกิน */
.cost-table td.cost-table-actions,
.cost-table th.cost-table-actions {
    width: 140px !important;
    min-width: 140px !important;
    white-space: nowrap;
}

/* ปรับกลุ่มข้อมูลไก่ */
.cost-chicken-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cost-chicken-summary img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
}

/* ถ้ามีเส้นกรอบจาก container ชั้นนอก */
.cost-card,
.cost-section,
.cost-panel,
.cost-table-section {
    border-left: none !important;
    border-right: none !important;
}
/* ==========================================================
   จำนวนไก่ทั้งหมด — Full-width record table
   ข้อมูลไก่ชิดซ้าย / จัดการชิดขวา
   ไม่มีเส้นกรอบซ้าย-ขวา
   ========================================================== */

@media (min-width: 1200px) {

    /* ตารางขยายออกไปชนขอบของกล่อง จำนวนไก่ทั้งหมด */
    .chickens-page #chicken-table-shell {
        --record-columns:
            minmax(260px, 2.2fr)
            minmax(70px, .65fr)
            minmax(110px, .9fr)
            minmax(80px, .7fr)
            minmax(90px, .75fr)
            minmax(100px, .85fr)
            minmax(110px, .9fr)
            130px;

        width: calc(100% + 52px) !important;
        max-width: none !important;

        margin-left: -26px !important;
        margin-right: -26px !important;

        /* เอาเส้นซ้าย-ขวาออก */
        border-left: 0 !important;
        border-right: 0 !important;

        /* ไม่เอาทรงกล่องเล็กซ้อนในกล่องใหญ่ */
        border-radius: 0 !important;

        box-shadow: none !important;
    }


    /* ==============================
       Header
       ============================== */

    .chickens-page .chicken-record-header {
        padding-left: 20px !important;
        padding-right: 20px !important;

        background: #ffffff !important;

        border-left: 0 !important;
        border-right: 0 !important;
    }

    /* ข้อมูลไก่ ชิดซ้าย */
    .chickens-page .chicken-record-header > span:first-child {
        text-align: left !important;
        padding-left: 0 !important;
    }

    /* จัดการ ชิดขวา */
    .chickens-page .chicken-record-header > span:last-child {
        text-align: right !important;
        padding-right: 0 !important;
    }


    /* ==============================
       แต่ละรายการไก่
       ============================== */

    .chickens-page .chicken-record {
        padding-left: 20px !important;
        padding-right: 20px !important;

        border-left: 0 !important;
        border-right: 0 !important;

        /* เหลือเฉพาะเส้นแบ่งแนวนอน */
        border-bottom: 1px solid #edf0ee !important;

        border-radius: 0 !important;
        box-shadow: none !important;
    }


    /* คอลัมน์ข้อมูลไก่ */
    .chickens-page .chicken-record-identity-cell {
        padding-left: 0 !important;
    }


    /* คอลัมน์จัดการ */
    .chickens-page .chicken-record-actions {
        justify-content: flex-end !important;
        padding-right: 0 !important;
    }

    .chickens-page .chicken-record-actions .row-actions {
        justify-content: flex-end !important;
        width: 100% !important;
    }


    /* รายการสุดท้าย */
    .chickens-page .chicken-record:last-child {
        border-bottom: 0 !important;
    }
}

/* Detail popup actions — monochrome hierarchy (visual styling only). */
#chicken-modal .modal-header-actions {
    gap: 8px !important;
}

#chicken-modal .modal-header-action-button {
    height: 44px !important;
    min-height: 44px !important;
    padding-inline: 18px !important;
    gap: 8px !important;
    border-radius: 11px !important;
    font-family: "Prompt", "Noto Sans Thai", sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transform: none !important;
}

#chicken-modal .modal-header-action-button > i {
    color: currentColor !important;
    font-size: 17px !important;
    line-height: 1 !important;
}

#chicken-modal .modal-header-action-button.action-sell {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #111111 !important;
}

#chicken-modal .modal-header-action-button.action-sell:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #2a2a2a !important;
}

#chicken-modal .modal-header-action-button.action-lineage,
#chicken-modal .modal-header-action-button.action-edit {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #cfcfcf !important;
}

#chicken-modal .modal-header-action-button.action-lineage:hover,
#chicken-modal .modal-header-action-button.action-edit:hover {
    background: #f5f5f5 !important;
    color: #111111 !important;
    border-color: #111111 !important;
}

#chicken-modal .modal-header-action-button:focus-visible {
    outline: 2px solid #111111 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12) !important;
}

/* =====================================================
   DETAIL POPUP CONTENT — PREMIUM RECORD / SPECIFICATION
   Content presentation only; header actions intentionally excluded.
   ===================================================== */
#chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-detail-view:not([hidden]) {
    padding: 24px 28px 32px !important;
    color: #202020 !important;
    background: #ffffff !important;
    font-family: "Prompt", "Noto Sans Thai", sans-serif !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 41fr) minmax(0, 59fr) !important;
    grid-template-areas: "media information" !important;
    gap: 36px !important;
    align-items: start !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-main {
    grid-area: information;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-sidebar {
    grid-area: media;
    position: sticky !important;
    top: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-area {
    min-width: 0;
    padding: 0 0 20px;
    margin: 0 0 18px;
    border-bottom: 1px solid #e4e4e4;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-chicken-code {
    display: block;
    margin-bottom: 6px;
    color: #737373;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row h2 {
    min-width: 0;
    margin: 0;
    color: #111111;
    font-size: clamp(34px, 3.2vw, 42px);
    font-weight: 650;
    line-height: 1.16;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row .data-badge {
    flex: 0 0 auto;
    min-height: auto !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row .data-badge.status-father {
    color: #2563eb !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row .data-badge.status-mother {
    color: #db2777 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row .data-badge.status-general {
    color: #16a34a !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row .data-badge.status-sold {
    color: #64748b !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image {
    width: 100% !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 3 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 20px !important;
    background: #f1f1ef !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    border-radius: inherit !important;
    object-fit: cover !important;
    object-position: center !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail-grid {
    gap: 8px !important;
    padding: 0 0 2px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail {
    width: 64px !important;
    height: 64px !important;
    flex-basis: 64px !important;
    padding: 2px !important;
    border: 1px solid #dedede !important;
    border-radius: 10px !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail:hover,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail.is-active {
    border-color: #111111 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail:focus-visible {
    outline: 2px solid #111111 !important;
    outline-offset: 2px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail img {
    border-radius: 7px !important;
    object-fit: cover !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-overview-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history {
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-section-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 20px 0 9px !important;
    padding: 20px 0 0 !important;
    border-top: 1px solid #e4e4e4 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    color: #202020 !important;
    background: transparent !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-overview-card > .showcase-section-title:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-section-title i,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card h3 i,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history h3 i {
    color: #626262 !important;
    font-size: 15px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel > div,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel > div {
    min-width: 0 !important;
    min-height: 44px !important;
    display: grid !important;
    grid-template-columns: minmax(88px, 0.82fr) minmax(0, 1.18fr) !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 9px 0 !important;
    border: 0 !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel span {
    color: #747474 !important;
    font-size: 12.5px !important;
    font-weight: 450 !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel strong {
    min-width: 0 !important;
    color: #202020 !important;
    font-size: 14.5px !important;
    font-weight: 550 !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-spec-empty,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-empty-value {
    color: #777777 !important;
    font-size: 13px !important;
    font-weight: 450 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .data-badge {
    width: fit-content;
    min-height: auto !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    color: #16a34a !important;
    background: transparent !important;
    font-size: 14.5px !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .status-success {
    color: #16a34a !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .status-warning,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .status-treatment {
    border: none !important;
    color: #ea580c !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .status-critical,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel .status-danger {
    border: none !important;
    color: #dc2626 !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history {
    padding: 18px 0 0 !important;
    border-top: 1px solid #e4e4e4 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card h3,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history h3 {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 0 10px !important;
    color: #202020 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-video-placeholder {
    min-height: 112px !important;
    height: 112px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    padding: 14px !important;
    border: 1px solid #e4e4e4 !important;
    border-radius: 12px !important;
    color: #6f6f6f !important;
    background: #f8f8f7 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-video-placeholder i {
    color: #555555 !important;
    font-size: 19px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card video {
    width: 100% !important;
    max-height: 260px !important;
    border-radius: 12px !important;
    background: #111111 !important;
    object-fit: contain !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats {
    gap: 10px 20px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats span,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail > span {
    color: #747474 !important;
    font-size: 12px !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-stats strong,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-detail > p {
    color: #202020 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card {
    margin-top: 20px !important;
    padding-top: 12px !important;
    border-top: 1px solid #e4e4e4 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-toggle {
    min-height: 52px !important;
    padding: 8px 0 !important;
    color: #202020 !important;
    background: transparent !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-toggle-left > i,
#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-chevron {
    color: #626262 !important;
}

#chicken-modal #chicken-modal-dialog.is-detail-showcase .health-history-toggle:focus-visible {
    outline: 2px solid #111111 !important;
    outline-offset: 3px !important;
    border-radius: 8px !important;
}

@media (max-width: 900px) {
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-detail-view:not([hidden]) {
        padding: 22px 22px 28px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
        grid-template-columns: minmax(230px, 38fr) minmax(0, 62fr) !important;
        gap: 24px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row h2 {
        font-size: clamp(32px, 4.4vw, 38px);
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
        column-gap: 20px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel > div {
        grid-template-columns: minmax(76px, 0.75fr) minmax(0, 1.25fr) !important;
        gap: 9px !important;
    }
}

@media (max-width: 760px) {
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .chicken-detail-view:not([hidden]) {
        padding: 18px 16px 28px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-main,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .detail-showcase-sidebar {
        display: contents !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-area {
        order: 1;
        width: 100%;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-main-image {
        order: 2;
        width: 100% !important;
        margin: 0 0 10px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-thumbnail-grid {
        order: 3;
        margin-bottom: 14px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-overview-card {
        order: 4;
        width: 100%;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-media-card {
        order: 5;
        width: 100%;
        margin-top: 20px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fight-history {
        order: 6;
        width: 100%;
        margin-top: 18px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-history-card {
        order: 7;
        width: 100%;
        margin-top: 20px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px 12px;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-identity-row h2 {
        flex: 1 1 210px;
        font-size: clamp(32px, 9vw, 38px);
    }
}

@media (max-width: 560px) {
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-fact-grid > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-lineage-grid > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-health-panel > div,
    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-vaccine-panel > div {
        grid-template-columns: minmax(92px, 0.72fr) minmax(0, 1.28fr) !important;
        gap: 12px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-detail-showcase .showcase-section-title {
        margin-top: 18px !important;
        padding-top: 18px !important;
    }
}

/* ========================================================================== 
   Edit chicken modal polish — current composition, cost-modal design language.
   Scoped to the active edit form so the detail and health modal families keep
   their existing visual composition and behavior.
   ========================================================================== */
#chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large:has(#chicken-edit-form:not([hidden])) {
    width: min(1180px, calc(100vw - 40px)) !important;
    max-width: 1180px !important;
    max-height: calc(100dvh - 40px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 20px !important;
    background: #ffffff !important;
    box-shadow: 0 20px 50px rgba(18, 36, 26, 0.14) !important;
}

#chicken-modal #chicken-modal-dialog:has(#chicken-edit-form:not([hidden])) > .chicken-modal-header {
    min-height: 70px !important;
    flex: 0 0 auto !important;
    padding: 16px 20px 14px 24px !important;
    border-bottom: 1px solid #e4e9e5 !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-modal-dialog:has(#chicken-edit-form:not([hidden])) > .chicken-modal-header h2 {
    margin: 0 !important;
    color: #172019 !important;
    font-size: clamp(1.35rem, 1.8vw, 1.5rem) !important;
    font-weight: 650 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.015em !important;
}

#chicken-modal #chicken-modal-dialog:has(#chicken-edit-form:not([hidden])) > .chicken-modal-header .modal-eyebrow {
    display: none !important;
}

/* Removed legacy 38px close button override so Edit mode uses Master close button */

#chicken-modal #chicken-edit-form.detail-showcase-edit:not([hidden]) {
    display: flex !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-edit-form > .edit-chicken-dialog__body {
    display: grid !important;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.52fr) !important;
    grid-template-areas:
        "media info"
        "fight info" !important;
    align-items: start !important;
    gap: 16px !important;
    min-height: 0 !important;
    padding: 20px 24px 24px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    scrollbar-color: #aebbb3 #eef2ef !important;
    scrollbar-width: thin !important;
    background: #f5f7f5 !important;
}

#chicken-modal #chicken-edit-form > .edit-chicken-dialog__body::-webkit-scrollbar {
    width: 10px !important;
}

#chicken-modal #chicken-edit-form > .edit-chicken-dialog__body::-webkit-scrollbar-track {
    background: #eef2ef !important;
}

#chicken-modal #chicken-edit-form > .edit-chicken-dialog__body::-webkit-scrollbar-thumb {
    border: 2px solid #eef2ef !important;
    border-radius: 999px !important;
    background: #aebbb3 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group {
    grid-area: info !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    align-self: start !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card,
#chicken-modal #chicken-edit-form .edit-showcase-card {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 18px !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card {
    width: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:first-child {
    border-radius: 16px 16px 0 0 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:last-child {
    border-radius: 0 0 16px 16px !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card + .edit-showcase-card {
    border-top: 1px solid #e4e9e5 !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-media {
    grid-area: media !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-fight {
    grid-area: fight !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-section-heading,
#chicken-modal #chicken-edit-form .chicken-form-section-heading {
    margin: 0 0 16px !important;
    padding: 0 !important;
}

#chicken-modal #chicken-edit-form .showcase-kicker {
    display: none !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-section-heading h3,
#chicken-modal #chicken-edit-form .chicken-form-section-heading h3 {
    margin: 0 !important;
    color: #172019 !important;
    font-size: 1.05rem !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.01em !important;
}

#chicken-modal #chicken-edit-form .chicken-form-section-heading > span {
    color: #4e6658 !important;
    background: #eef3f0 !important;
    border: 1px solid #dfe7e1 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .chicken-form-section-heading p {
    max-width: 70ch !important;
    margin: 3px 0 0 !important;
    color: #66736c !important;
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-edit-form .edit-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 16px !important;
    row-gap: 14px !important;
}

#chicken-modal #chicken-edit-form .edit-form-field {
    gap: 6px !important;
    min-width: 0 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field label {
    margin: 0 !important;
    color: #48544d !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field label [aria-hidden="true"] {
    color: #b93f3f !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea) {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    color: #172019 !important;
    border: 1px solid #d5dcd7 !important;
    border-radius: 9px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 0.875rem !important;
}

#chicken-modal #chicken-edit-form .edit-form-field input,
#chicken-modal #chicken-edit-form .edit-form-field select {
    height: 44px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field textarea {
    min-height: 96px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    resize: vertical !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea)::placeholder {
    color: #7c8780 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea):hover:not(:disabled):not([readonly]) {
    border-color: #aebbb3 !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea):focus,
#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea):focus-visible {
    border-color: #17653d !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, 0.14) !important;
    outline: none !important;
}

#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea)[readonly],
#chicken-modal #chicken-edit-form .edit-form-field :is(input, select, textarea):disabled {
    color: #59645d !important;
    border-color: #dfe4e0 !important;
    background: #f0f3f1 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

#chicken-modal #chicken-edit-form .form-hint {
    color: #66736c !important;
    font-size: 0.75rem !important;
    line-height: 1.45 !important;
}

#chicken-modal #chicken-edit-form .form-error {
    color: #a93636 !important;
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
}

#chicken-modal #chicken-edit-form .lineage-autocomplete-control > i {
    color: #66736c !important;
}

#chicken-modal #chicken-edit-form .lineage-autocomplete-menu {
    border-color: #d5dcd7 !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 28px rgba(18, 36, 26, 0.14) !important;
}

#chicken-modal #chicken-edit-form .lineage-autocomplete-menu button:hover,
#chicken-modal #chicken-edit-form .lineage-autocomplete-menu button:focus-visible {
    background: #edf5f0 !important;
}

#chicken-modal #chicken-edit-form .media-file-input,
#chicken-modal #chicken-edit-form #edit-chicken-video {
    padding: 6px 8px !important;
}

#chicken-modal #chicken-edit-form .media-image-manager {
    width: 100% !important;
    margin-top: 4px !important;
}

#chicken-modal #chicken-edit-form .media-main-image-preview {
    min-height: 0 !important;
    aspect-ratio: 4 / 3 !important;
    margin: 8px 0 12px !important;
    overflow: hidden !important;
    border: 1px solid #d9e1db !important;
    border-radius: 12px !important;
    background: #edf1ee !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .media-main-image-preview > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#chicken-modal #chicken-edit-form .media-primary-label {
    left: 10px !important;
    bottom: 10px !important;
    color: #ffffff !important;
    background: rgba(23, 101, 61, 0.92) !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .media-thumbnail-strip {
    gap: 8px !important;
}

#chicken-modal #chicken-edit-form .edit-showcase-thumbnails {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 0 !important;
}

#chicken-modal #chicken-edit-form .managed-image-thumbnail,
#chicken-modal #chicken-edit-form .image-add-tile {
    flex: 0 0 76px !important;
    width: 76px !important;
    height: 76px !important;
    border-radius: 10px !important;
}

#chicken-modal #chicken-edit-form .managed-image-thumbnail {
    border: 1px solid #d8e0da !important;
    background: #edf1ee !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .managed-image-thumbnail.is-primary {
    border-color: #17653d !important;
    outline: 2px solid rgba(23, 101, 61, 0.16) !important;
    outline-offset: 1px !important;
}

#chicken-modal #chicken-edit-form .image-add-tile {
    color: #315f45 !important;
    border: 1px dashed #9fb2a5 !important;
    background: #f5f8f6 !important;
}

#chicken-modal #chicken-edit-form .image-add-tile:hover,
#chicken-modal #chicken-edit-form .image-add-tile:focus-within {
    color: #17653d !important;
    border-color: #17653d !important;
    background: #eef6f1 !important;
    transform: none !important;
}

#chicken-modal #chicken-edit-form .image-add-tile:focus-visible,
#chicken-modal #chicken-edit-form .managed-image-actions button:focus-visible {
    outline: 3px solid rgba(23, 101, 61, 0.18) !important;
    outline-offset: 2px !important;
}

#chicken-modal #chicken-edit-form .edit-video-preview {
    margin-top: 8px !important;
    padding: 10px !important;
    border: 1px solid #dfe5e1 !important;
    border-radius: 10px !important;
    background: #f6f8f6 !important;
    box-shadow: none !important;
}

#chicken-modal #chicken-edit-form .edit-readonly-history {
    display: grid !important;
    gap: 8px !important;
    margin-top: 16px !important;
}

#chicken-modal #chicken-edit-form .edit-readonly-history details {
    overflow: hidden !important;
    border: 1px solid #e0e6e2 !important;
    border-radius: 9px !important;
    background: #f8faf8 !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions {
    position: static !important;
    z-index: auto !important;
    display: flex !important;
    min-height: 72px !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 14px 24px !important;
    border-top: 1px solid #dfe5e1 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions :is(.modal-cancel-button, .modal-save-button) {
    min-width: 112px !important;
    min-height: 44px !important;
    padding: 0 18px !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    font-size: 0.875rem !important;
    font-weight: 650 !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions .modal-cancel-button {
    color: #334039 !important;
    border: 1px solid #d2dad4 !important;
    background: #ffffff !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions .modal-cancel-button:hover {
    border-color: #aebbb3 !important;
    background: #f3f6f4 !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions .modal-save-button {
    color: #ffffff !important;
    border: 1px solid #17653d !important;
    background: #17653d !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions .modal-save-button:hover:not(:disabled) {
    border-color: #124f30 !important;
    background: #124f30 !important;
    transform: none !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions :is(.modal-cancel-button, .modal-save-button):focus-visible {
    outline: 3px solid rgba(23, 101, 61, 0.2) !important;
    outline-offset: 2px !important;
}

#chicken-modal #chicken-edit-form > .edit-form-actions .modal-save-button:disabled {
    color: #f8faf9 !important;
    border-color: #8ca99a !important;
    background: #8ca99a !important;
    cursor: not-allowed !important;
}

@media (max-width: 900px) {
    #chicken-modal #chicken-edit-form > .edit-chicken-dialog__body {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-areas: "media" "info" "fight" !important;
        gap: 14px !important;
        padding: 16px !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-media,
    #chicken-modal #chicken-edit-form .edit-showcase-info-group,
    #chicken-modal #chicken-edit-form .edit-showcase-fight {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 100% !important;
        order: initial !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-media { order: 1 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-info-group { order: 2 !important; }
    #chicken-modal #chicken-edit-form .edit-showcase-fight { order: 3 !important; }
}

@media (max-width: 560px) {
    #chicken-modal #chicken-modal-dialog.chicken-modal-dialog.modal-size-large:has(#chicken-edit-form:not([hidden])) {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 18px !important;
    }

    #chicken-modal #chicken-modal-dialog:has(#chicken-edit-form:not([hidden])) > .chicken-modal-header {
        min-height: 62px !important;
        padding: 12px 12px 12px 16px !important;
    }

    #chicken-modal #chicken-modal-dialog:has(#chicken-edit-form:not([hidden])) > .chicken-modal-header h2 {
        font-size: 1.25rem !important;
    }

    #chicken-modal #chicken-edit-form > .edit-chicken-dialog__body {
        gap: 12px !important;
        padding: 10px !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-info-group,
    #chicken-modal #chicken-edit-form .edit-showcase-card {
        border-radius: 14px !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card,
    #chicken-modal #chicken-edit-form .edit-showcase-card {
        padding: 14px !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:first-child {
        border-radius: 14px 14px 0 0 !important;
    }

    #chicken-modal #chicken-edit-form .edit-showcase-info-group > .edit-showcase-card:last-child {
        border-radius: 0 0 14px 14px !important;
    }

    #chicken-modal #chicken-edit-form .edit-form-grid,
    #chicken-modal #chicken-edit-form .fight-stat-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        row-gap: 12px !important;
    }

    #chicken-modal #chicken-edit-form .edit-form-field,
    #chicken-modal #chicken-edit-form .edit-form-full {
        grid-column: 1 !important;
    }

    #chicken-modal #chicken-edit-form > .edit-form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) !important;
        min-height: 68px !important;
        padding: 12px !important;
    }

    #chicken-modal #chicken-edit-form > .edit-form-actions :is(.modal-cancel-button, .modal-save-button) {
        min-width: 0 !important;
        width: 100% !important;
        padding-inline: 10px !important;
    }

    #chicken-modal #chicken-edit-form .managed-image-thumbnail,
    #chicken-modal #chicken-edit-form .image-add-tile {
        flex-basis: 72px !important;
        width: 72px !important;
        height: 72px !important;
    }
}

/* Health history popup: scoped filtering and independent 3-item pagination. */
#health-history-view .history-popup-section {
    display: grid;
    gap: 14px;
}

#health-history-view .history-filter-toolbar {
    display: flex;
    align-items: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dfe7e2;
    border-radius: 12px;
    background: #f8faf9;
}

#health-history-view .history-filter-control {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #45534b;
    font-size: 0.75rem;
    font-weight: 600;
}

#health-history-view .history-filter-search {
    flex: 1 1 190px;
}

#health-history-view .history-filter-status {
    flex: 0 1 142px;
}

#health-history-view .history-search-input {
    position: relative;
    display: block;
}

#health-history-view .history-search-input > i {
    position: absolute;
    top: 50%;
    left: 12px;
    z-index: 1;
    color: #65736b;
    transform: translateY(-50%);
    pointer-events: none;
}

#health-history-view .history-filter-control :is(input, select) {
    width: 100%;
    height: 42px;
    min-width: 0;
    padding: 0 11px;
    border: 1px solid #cfd9d3;
    border-radius: 9px;
    background: #fff;
    color: #1d2b23;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    outline: none;
}

#health-history-view .history-search-input input {
    padding-left: 36px;
}

#health-history-view .history-filter-control :is(input, select):focus-visible {
    border-color: #17653d;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, 0.16);
}

#health-history-view .history-filter-dates {
    display: flex;
    flex: 1 1 250px;
    gap: 8px;
    min-width: 230px;
}

#health-history-view .history-filter-dates .history-filter-control {
    flex: 1 1 0;
}

#health-history-view .history-filter-clear,
#health-history-view .history-popup-empty [data-history-clear] {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #cfd9d3;
    border-radius: 9px;
    background: #fff;
    color: #33473c;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

#health-history-view .history-filter-clear:hover:not(:disabled),
#health-history-view .history-popup-empty [data-history-clear]:hover {
    border-color: #17653d;
    color: #17653d;
}

#health-history-view .history-filter-clear:focus-visible,
#health-history-view .history-popup-empty [data-history-clear]:focus-visible,
#health-history-view .history-page-button:focus-visible {
    outline: 3px solid rgba(23, 101, 61, 0.2);
    outline-offset: 2px;
}

#health-history-view .history-filter-clear:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

#health-history-view .history-result-meta {
    display: flex;
    justify-content: flex-end;
    min-height: 20px;
    color: #5f6e65;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

#health-history-view .history-filter-error {
    margin: 0 0 8px;
    color: #a33232;
    font-size: 0.8rem;
}

#health-history-view :is(.history-list, .treatment-history-list) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border-top: 1px solid #e4ebe7;
}

#health-history-view :is(.history-card, .treatment-history-card) {
    margin: 0;
    padding: 14px 2px;
    border: 0;
    border-bottom: 1px solid #e4ebe7;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#health-history-view :is(.history-card, .treatment-history-card):last-child {
    border-bottom: 0;
}

#health-history-view .history-card > div:first-child,
#health-history-view .treatment-history-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#health-history-view :is(.history-card, .treatment-history-card) p {
    margin: 6px 0 0;
    color: #45534b;
    line-height: 1.55;
}

#health-history-view .treatment-history-actions {
    margin-top: 10px;
}

#health-history-view .history-popup-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 28px 16px;
    border: 1px dashed #ccd8d1;
    border-radius: 12px;
    color: #617168;
    text-align: center;
}

#health-history-view .history-popup-empty > i {
    color: #17653d;
    font-size: 1.25rem;
}

#health-history-view .history-popup-empty strong {
    color: #26382e;
}

#health-history-view .history-popup-empty span {
    font-size: 0.82rem;
}

#health-history-view .history-popup-empty [data-history-clear] {
    margin-top: 6px;
}

#health-history-view .history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

#health-history-view .history-page-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d3ddd7;
    border-radius: 9px;
    background: #fff;
    color: #405047;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

#health-history-view .history-page-button:hover:not(:disabled):not(.is-active) {
    border-color: #8fac9b;
    color: #17653d;
}

#health-history-view .history-page-button.is-active {
    border-color: #17653d;
    background: #17653d;
    color: #fff;
}

#health-history-view .history-page-button:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

#health-history-view .history-pagination-ellipsis {
    width: 24px;
    color: #748178;
    text-align: center;
}

@media (max-width: 760px) {
    #health-history-view .history-filter-toolbar {
        flex-wrap: wrap;
    }

    #health-history-view .history-filter-search {
        flex-basis: min(100%, 260px);
    }

    #health-history-view .history-filter-dates {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    #health-history-view .history-filter-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    #health-history-view .history-filter-dates {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        min-width: 0;
    }

    #health-history-view .history-filter-clear {
        width: 100%;
    }

    #health-history-view .history-card > div:first-child,
    #health-history-view .treatment-history-card-head {
        display: grid;
        gap: 3px;
    }
}

/* Existing detail-history tabs: shared 3-item pagination without changing the modal layout. */
#chicken-detail-view .detail-history-browser .history-result-meta {
    display: flex;
    justify-content: flex-end;
    min-height: 20px;
    margin: 10px 0 4px;
    color: #5f6e65;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

#chicken-detail-view .detail-history-browser .history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

#chicken-detail-view .detail-history-browser .history-page-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d3ddd7;
    border-radius: 9px;
    background: #fff;
    color: #405047;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

#chicken-detail-view .detail-history-browser .history-page-button:hover:not(:disabled):not(.is-active) {
    border-color: #8fac9b;
    color: #17653d;
}

#chicken-detail-view .detail-history-browser .history-page-button.is-active {
    border-color: #17653d;
    background: #17653d;
    color: #fff;
}

#chicken-detail-view .detail-history-browser .history-page-button:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

#chicken-detail-view .detail-history-browser .history-pagination-ellipsis {
    width: 24px;
    color: #748178;
    text-align: center;
}
/* แก้ไอคอนค้นหาทับข้อความในช่อง พ่อพันธุ์ / แม่พันธุ์ */
#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control {
    position: relative !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control > i {
    position: absolute !important;
    top: 50% !important;
    left: 14px !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    display: grid !important;
    place-items: center !important;
    color: #66736c !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

#chicken-modal #chicken-modal-dialog.is-edit-showcase .lineage-autocomplete-control > input[type="text"] {
    padding-left: 44px !important;
}

/* =====================================================
   HEALTH HISTORY — quiet, single-layer reading surface
   ===================================================== */
#chicken-modal #chicken-modal-dialog.modal-size-medium.is-health-history {
    display: flex !important;
    flex-direction: column !important;
    width: min(860px, calc(100vw - 40px)) !important;
    max-width: 860px !important;
    max-height: min(88dvh, 790px) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid #e1e6e3 !important;
    border-radius: 18px !important;
    background: #ffffff !important;
    box-shadow: 0 18px 48px rgba(20, 32, 25, 0.16) !important;
}

#chicken-modal #chicken-modal-dialog.is-health-history .chicken-modal-header {
    position: relative !important;
    top: auto !important;
    flex: 0 0 auto !important;
    min-height: 64px !important;
    padding: 14px 18px 14px 20px !important;
    border-bottom: 1px solid #e5e9e7 !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
}

#chicken-modal #chicken-modal-dialog.is-health-history .modal-header-title h2 {
    color: #202622 !important;
    font-size: clamp(1.3rem, 2.5vw, 1.55rem) !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
}

#chicken-modal #chicken-modal-dialog.is-health-history .modal-eyebrow {
    display: none !important;
}

/* Removed legacy 38px close button override so Health History uses Master close button */

#chicken-modal #chicken-modal-dialog.is-health-history #health-history-view:not([hidden]) {
    position: relative;
    display: block !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 20px 22px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b9c3bd transparent;
    background: #ffffff !important;
}

#chicken-modal #chicken-modal-dialog.is-health-history #health-history-view::-webkit-scrollbar {
    width: 8px;
}

#chicken-modal #chicken-modal-dialog.is-health-history #health-history-view::-webkit-scrollbar-thumb {
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #b9c3bd;
}

#health-history-view .health-history-summary {
    display: grid;
    grid-template-columns: 56px repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 16px;
    padding: 16px 0 18px;
    border-bottom: 1px solid #e7ebe9;
}

#health-history-view .health-history-summary > img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 11px;
    background: #f2f4f3;
}

#health-history-view .health-summary-item {
    min-width: 0;
}

#health-history-view .health-summary-item > span:first-child {
    display: block;
    margin-bottom: 4px;
    color: #6a746e;
    font-size: 0.75rem;
    font-weight: 500;
}

#health-history-view .health-summary-item > strong {
    display: block;
    overflow: hidden;
    color: #222b26;
    font-size: 0.9rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#health-history-view .health-summary-item .data-badge,
#health-history-view .history-record-head .data-badge {
    min-height: 26px;
    padding: 4px 9px;
    border: 0;
    font-size: 0.72rem;
    font-weight: 650;
}

#health-history-view .status-treatment {
    background: #eef5f1;
    color: #17653d;
}

#health-history-view .status-critical {
    background: #fbefee;
    color: #9a3931;
}

#health-history-view .status-success {
    background: #edf6ef;
    color: #296241;
}

#health-history-view .history-popup-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #e5e9e7;
}

#health-history-view .history-popup-tabs button {
    position: relative;
    min-height: 48px;
    padding: 2px 0 0;
    border: 0;
    background: transparent;
    color: #6a746e;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}

#health-history-view .history-popup-tabs button::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: transparent;
    content: "";
}

#health-history-view .history-popup-tabs button:hover,
#health-history-view .history-popup-tabs button.is-active {
    color: #174d32;
}

#health-history-view .history-popup-tabs button.is-active::after {
    background: #17653d;
}

#health-history-view .history-popup-tabs button:focus-visible {
    outline: 3px solid rgba(23, 101, 61, 0.18);
    outline-offset: 3px;
}

#health-history-view .history-popup-section {
    display: grid;
    gap: 12px;
    margin: 0;
    padding-top: 16px;
}

#health-history-view .history-popup-section[hidden] {
    display: none !important;
}

#health-history-view .history-filter-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 14px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid #edf0ee;
    border-radius: 0;
    background: transparent;
}

#health-history-view .history-filter-control {
    display: block;
    min-width: 0;
}

#health-history-view .history-filter-search {
    flex: 1 1 260px;
}

#health-history-view .history-filter-status {
    flex: 0 0 146px;
}

#health-history-view .history-search-input {
    position: relative;
    display: block;
}

#health-history-view .history-search-input > i {
    position: absolute;
    top: 50%;
    left: 12px;
    z-index: 1;
    color: #68746d;
    transform: translateY(-50%);
    pointer-events: none;
}

#health-history-view .history-filter-control :is(input, select) {
    width: 100%;
    height: 40px;
    min-width: 0;
    padding: 0 11px;
    border: 1px solid #d3dad6;
    border-radius: 9px;
    background: #ffffff;
    color: #253029;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 400;
    outline: none;
}

#health-history-view .history-search-input input {
    padding-left: 36px;
}

#health-history-view .history-filter-control :is(input, select):focus-visible {
    border-color: #17653d;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, 0.14);
}

#health-history-view .history-date-filter {
    position: relative;
    flex: 0 0 158px;
    min-width: 0;
}

#health-history-view .history-date-dropdown {
    position: relative;
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    border: 1px solid #d3dad6;
    border-radius: 9px;
    background: #ffffff;
    box-shadow: none;
}

#health-history-view .history-date-dropdown > .custom-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
    border: 0;
    background: transparent;
    color: #324138;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 550;
}

#health-history-view .history-date-dropdown > .custom-dropdown-toggle span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#health-history-view .history-date-dropdown:focus-within {
    border-color: #17653d;
    box-shadow: 0 0 0 3px rgba(23, 101, 61, 0.14);
}

#health-history-view .history-date-panel {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 90;
    width: min(430px, calc(100vw - 48px));
}

#health-history-view .history-date-range {
    grid-template-columns: 1fr;
}

#health-history-view .history-filter-clear,
#health-history-view .history-popup-empty [data-history-clear] {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid #d3dad6;
    border-radius: 9px;
    background: #ffffff;
    color: #46534c;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

#health-history-view .history-filter-clear:hover:not(:disabled),
#health-history-view .history-popup-empty [data-history-clear]:hover {
    border-color: #8daa99;
    color: #17653d;
}

#health-history-view .history-filter-clear:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

#health-history-view .history-result-meta {
    display: flex;
    justify-content: flex-start;
    min-height: 18px;
    color: #68746d;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

#health-history-view .history-filter-error {
    margin: 0;
    color: #a23832;
    font-size: 0.78rem;
}

#health-history-view :is(.history-list, .treatment-history-list) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border-top: 1px solid #e4e9e6;
}

#health-history-view :is(.history-card, .treatment-history-card) {
    margin: 0;
    padding: 16px 0;
    border: 0;
    border-bottom: 1px solid #e4e9e6;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#health-history-view :is(.history-card, .treatment-history-card):last-child {
    border-bottom: 0;
}

#health-history-view .history-record-head,
#health-history-view .treatment-history-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#health-history-view .history-record-head > time {
    color: #68746d;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#health-history-view .treatment-history-card-head > div > span {
    display: block;
    margin-bottom: 3px;
    color: #68746d;
    font-size: 0.72rem;
    font-weight: 500;
}

#health-history-view .treatment-history-card-head strong {
    color: #253029;
    font-size: 0.9rem;
    font-weight: 650;
}

#health-history-view .history-record-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 13px;
}

#health-history-view .history-record-field {
    min-width: 0;
}

#health-history-view .history-record-field-wide {
    grid-column: span 2;
}

#health-history-view .history-record-field > span {
    display: block;
    margin-bottom: 4px;
    color: #68746d;
    font-size: 0.74rem;
    font-weight: 500;
}

#health-history-view .history-record-field > p {
    margin: 0;
    overflow-wrap: anywhere;
    color: #2b3630;
    font-size: 0.84rem;
    line-height: 1.55;
}

#health-history-view .treatment-history-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

#health-history-view .treatment-history-actions button {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    background: #ffffff;
    color: #385044;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
}

#health-history-view .treatment-history-actions button:hover {
    border-color: #8daa99;
    color: #17653d;
}

#health-history-view .treatment-history-actions .treatment-delete-button {
    color: #9a3931;
}

#health-history-view .history-popup-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 30px 16px;
    border: 0;
    border-radius: 0;
    color: #68746d;
    text-align: center;
}

#health-history-view .history-popup-empty strong {
    color: #2b3630;
    font-size: 0.9rem;
}

#health-history-view .history-popup-empty span {
    font-size: 0.8rem;
}

#health-history-view .history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

#health-history-view .history-page-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    background: #ffffff;
    color: #46534c;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#health-history-view .history-page-button.is-active {
    border-color: #17653d;
    background: #17653d;
    color: #ffffff;
}

#health-history-view :is(.history-filter-clear, .history-popup-empty [data-history-clear], .history-page-button, .treatment-history-actions button):focus-visible {
    outline: 3px solid rgba(23, 101, 61, 0.18);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    #chicken-modal #chicken-modal-dialog.modal-size-medium.is-health-history {
        width: min(820px, calc(100vw - 24px)) !important;
        max-height: calc(100dvh - 24px) !important;
    }
}

@media (max-width: 760px) {
    #health-history-view .health-history-summary {
        grid-template-columns: 52px repeat(2, minmax(0, 1fr));
        gap: 12px 14px;
    }

    #health-history-view .health-history-summary > img {
        width: 52px;
        height: 52px;
        grid-row: span 2;
    }

    #health-history-view .history-filter-toolbar {
        flex-wrap: wrap;
    }

    #health-history-view .history-filter-search {
        flex: 1 1 100%;
    }

    #health-history-view .history-filter-status,
    #health-history-view .history-date-filter {
        flex: 1 1 150px;
    }
}

@media (max-width: 520px) {
    #chicken-modal #chicken-modal-dialog.modal-size-medium.is-health-history {
        width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 16px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-health-history .chicken-modal-header {
        min-height: 60px !important;
        padding: 11px 12px 11px 16px !important;
    }

    #chicken-modal #chicken-modal-dialog.is-health-history #health-history-view:not([hidden]) {
        padding: 0 16px 18px !important;
    }

    #health-history-view .health-history-summary {
        grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px 12px;
        padding-block: 14px 16px;
    }

    #health-history-view .health-history-summary > img {
        width: 48px;
        height: 48px;
    }

    #health-history-view .history-popup-tabs {
        gap: 20px;
    }

    #health-history-view .history-popup-tabs button {
        min-height: 46px;
        font-size: 0.84rem;
    }

    #health-history-view .history-filter-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }

    #health-history-view .history-filter-search,
    #health-history-view .history-filter-status,
    #health-history-view .history-date-filter {
        width: 100%;
    }

    #health-history-view .history-filter-clear {
        width: 100%;
    }

    #health-history-view .history-date-panel {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: min(70vh, 520px);
        overflow-y: auto;
    }

    #health-history-view .history-record-head,
    #health-history-view .treatment-history-card-head {
        display: grid;
        gap: 6px;
    }

    #health-history-view .history-record-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 11px;
    }

    #health-history-view .history-record-field-wide {
        grid-column: auto;
    }

    #health-history-view .treatment-history-actions {
        justify-content: stretch;
    }

    #health-history-view .treatment-history-actions button {
        flex: 1 1 0;
    }
}

/* ==========================================================================
   CONFIRMATION MODAL MASTER CLOSE BUTTON
   Standardized to match Master Reference: รายละเอียดไก่ชน (.modal-close-button)
   ========================================================================== */
#delete-chicken-confirm .dashboard-confirm-header,
#chicken-action-confirm .dashboard-confirm-header,
.dashboard-confirm-modal .dashboard-confirm-header {
    position: relative !important;
    padding-right: 68px !important;
}

#delete-chicken-confirm .dashboard-confirm-close,
#chicken-action-confirm .dashboard-confirm-close,
.dashboard-confirm-modal .dashboard-confirm-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #374151 !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1) !important;
    font-size: 20px !important;
    cursor: pointer !important;
    z-index: 30 !important;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 140ms ease !important;
}

#delete-chicken-confirm .dashboard-confirm-close i,
#chicken-action-confirm .dashboard-confirm-close i,
.dashboard-confirm-modal .dashboard-confirm-close i {
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#delete-chicken-confirm .dashboard-confirm-close:hover:not(:disabled),
#chicken-action-confirm .dashboard-confirm-close:hover:not(:disabled),
.dashboard-confirm-modal .dashboard-confirm-close:hover:not(:disabled) {
    background: #111827 !important;
    border-color: #111827 !important;
    color: #ffffff !important;
    transform: rotate(90deg) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18) !important;
}

#delete-chicken-confirm .dashboard-confirm-close:active:not(:disabled),
#chicken-action-confirm .dashboard-confirm-close:active:not(:disabled),
.dashboard-confirm-modal .dashboard-confirm-close:active:not(:disabled) {
    transform: rotate(90deg) scale(0.92) !important;
}

#delete-chicken-confirm .dashboard-confirm-close:focus-visible,
#chicken-action-confirm .dashboard-confirm-close:focus-visible,
.dashboard-confirm-modal .dashboard-confirm-close:focus-visible {
    outline: 3px solid rgba(242, 101, 34, 0.24) !important;
    outline-offset: 2px !important;
}

@media (max-width: 640px) {
    #delete-chicken-confirm .dashboard-confirm-header,
    #chicken-action-confirm .dashboard-confirm-header,
    .dashboard-confirm-modal .dashboard-confirm-header {
        padding-right: 64px !important;
    }

    #delete-chicken-confirm .dashboard-confirm-close,
    #chicken-action-confirm .dashboard-confirm-close,
    .dashboard-confirm-modal .dashboard-confirm-close {
        top: 14px !important;
        right: 14px !important;
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
        border-radius: 50% !important;
    }
}
/* ==========================================================
   ปรับการ์ดสรุปสถิติ (Summary Cards) เป็นโทนสี เขียว-ขาว
   ========================================================== */

@media (min-width: 901px) {
    .chickens-page .chicken-summary-grid {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 12px !important;
        margin-bottom: 24px !important;
    }

    /* 1. สถานะปกติ (ยังไม่กด) : พื้นหลังขาว ตัวหนังสือเข้ม */
    .chickens-page .chicken-summary-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        position: relative !important;
        min-height: 120px !important;
        padding: 18px 20px !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 18px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        cursor: pointer !important;
        transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
    }

    .chickens-page .chicken-summary-card:hover {
        transform: translateY(-2px) !important;
        border-color: #cbd5e1 !important;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
    }

    /* กลุ่มข้อความซ้ายบน */
    .chickens-page .chicken-summary-card .summary-card-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        order: 1 !important;
        width: 100% !important;
    }

    .chickens-page .chicken-summary-card .summary-card-label {
        font-size: 13px !important;
        font-weight: 500 !important;
        color: #64748b !important;
        margin: 0 !important;
    }

    .chickens-page .chicken-summary-card .summary-card-content strong {
        font-size: 30px !important;
        font-weight: 600 !important;
        letter-spacing: -1px !important;
        color: #0f172a !important;
        display: flex !important;
        align-items: baseline !important;
        gap: 4px !important;
        line-height: 1 !important;
    }

    .chickens-page .chicken-summary-card .summary-card-content small {
        font-size: 13px !important;
        font-weight: 500 !important;
        color: #94a3b8 !important;
    }

    /* ไอคอนมุมขวาบน (สถานะปกติ) */
    .chickens-page .chicken-summary-card .summary-card-icon {
        position: absolute !important;
        top: 16px !important;
        right: 16px !important;
        width: 32px !important;
        height: 32px !important;
        display: grid !important;
        place-items: center !important;
        background: transparent !important;
        color: #64748b !important;
        font-size: 18px !important;
        order: 2 !important;
    }

    /* 2. สถานะ Active (ตอนกดเลือกแล้ว) : พื้นเขียวเข้ม ตัวหนังสือขาว */
    .chickens-page .chicken-summary-card.is-active {
        background: #17653d !important;
        border-color: #17653d !important;
        box-shadow: 0 8px 20px rgba(23, 101, 61, 0.22) !important;
        color: #ffffff !important;
    }

    .chickens-page .chicken-summary-card.is-active .summary-card-label {
        color: rgba(255, 255, 255, 0.85) !important;
    }

    .chickens-page .chicken-summary-card.is-active .summary-card-content strong {
        color: #ffffff !important;
    }

    .chickens-page .chicken-summary-card.is-active .summary-card-content small {
        color: rgba(255, 255, 255, 0.75) !important;
    }

    .chickens-page .chicken-summary-card.is-active .summary-card-icon {
        color: #ffffff !important;
    }

    /* ซ่อนลูกศรส่วนเกิน */
    .chickens-page .chicken-summary-card .summary-card-arrow {
        display: none !important;
    }
}

@media (max-width: 1280px) and (min-width: 901px) {
    .chickens-page .chicken-summary-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    .chickens-page .chicken-summary-card {
        padding: 12px 14px !important;
        min-height: 100px !important;
        border-radius: 14px !important;
    }
    .chickens-page .chicken-summary-card .summary-card-content strong {
        font-size: 22px !important;
    }
    .chickens-page .chicken-summary-card .summary-card-label {
        font-size: 11.5px !important;
    }
    .chickens-page .chicken-summary-card .summary-card-icon {
        width: 26px !important;
        height: 26px !important;
        font-size: 15px !important;
        top: 12px !important;
        right: 12px !important;
    }
}

/* ==========================================================================
   PEDIGREE TREE MODAL (ผังสาแหรก 4 รุ่น - Smooth Single-Surface Transition)
   ========================================================================== */
#chicken-modal #chicken-modal-dialog.is-lineage-view {
    display: flex !important;
    flex-direction: column !important;
    width: min(1200px, calc(100vw - 32px)) !important;
    max-width: 1200px !important;
    max-height: min(90dvh, 840px) !important;
    border-radius: 24px !important;
    background: #f8fafc !important;
    overflow: hidden !important;
}

#chicken-modal #chicken-modal-dialog.is-lineage-view .chicken-modal-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    min-height: 68px !important;
    padding: 14px 20px !important;
}

#chicken-modal #chicken-modal-dialog.is-lineage-view .modal-lineage-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-left: auto !important;
    margin-right: 12px !important;
}

.modal-header-action-button.action-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-header-action-button.action-back:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.showcase-lineage-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
}

.inline-open-lineage-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #eef7f2;
    color: #17653d;
    border: 1px solid #b7dfc8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-open-lineage-btn:hover {
    background: #17653d;
    color: #ffffff;
    border-color: #17653d;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(23, 101, 61, 0.2);
}

.lineage-tree-view:not([hidden]) {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 0 !important;
    background: #f8fafc;
}

.lineage-popup-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px 28px;
    min-height: 100%;
}

.lineage-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 2px 4px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.lineage-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lineage-back-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lineage-back-pill:hover {
    background: #17653d;
    color: #ffffff;
    border-color: #17653d;
}

.lineage-stats-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.lineage-stats-pill strong {
    color: #17653d;
    font-weight: 700;
}

.lineage-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    font-weight: 600;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-item.is-subject { color: #17653d; }
.legend-item.is-father { color: #2563eb; }
.legend-item.is-mother { color: #db2777; }

.lineage-mobile-view-tabs {
    display: none;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 10px;
    gap: 3px;
}

.lineage-tab-btn {
    flex: 1;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lineage-tab-btn.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.lineage-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 11.5px;
    color: #64748b;
}

/* Tree Canvas & 4-Row Grid Pedigree Architecture (3 Generations) with Tree Connectors */
.lineage-tree-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    padding: 10px 10px 20px;
}

.lineage-tree-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.lineage-tree-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.lineage-tree-canvas {
    display: grid;
    grid-template-columns: repeat(3, minmax(200px, 260px));
    gap: 36px;
    width: 100%;
    min-width: 660px;
    max-width: 860px;
    margin: 0 auto;
    position: relative;
    padding: 8px 10px;
    box-sizing: border-box;
}

.lineage-gen-column {
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    width: 100%;
}

.lineage-gen-nodes {
    display: grid;
    grid-template-rows: repeat(4, minmax(72px, 1fr));
    gap: 16px;
    flex: 1;
    position: relative;
    min-width: 0;
    width: 100%;
}

/* Col 1: Subject (1 node spans all 4 rows) */
.lineage-gen-column.gen-1 .lineage-node-card {
    grid-row: 1 / span 4;
    align-self: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Col 1 -> Col 2 Connector (Right of Gen 1) */
.lineage-gen-column.gen-1 .lineage-node-card::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 50%;
    width: 18px;
    height: 2px;
    background: #10b981;
    z-index: 1;
    pointer-events: none;
}

/* Col 2: Father (1..2) & Mother (3..4) */
.lineage-gen-column.gen-2 .lineage-branch-group.branch-father {
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 0;
    width: 100%;
}

.lineage-gen-column.gen-2 .lineage-branch-group.branch-mother {
    grid-row: 3 / span 2;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 0;
    width: 100%;
}

.lineage-gen-column.gen-2 .lineage-node-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Col 2 Ingress Tree Connectors (Bracket from Col 1) */
.lineage-gen-column.gen-2 .lineage-branch-group.branch-father::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    bottom: -8px;
    width: 18px;
    border-left: 2px solid #94a3b8;
    border-top: 2px solid #3b82f6;
    border-top-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

.lineage-gen-column.gen-2 .lineage-branch-group.branch-mother::before {
    content: '';
    position: absolute;
    left: -18px;
    top: -8px;
    bottom: 50%;
    width: 18px;
    border-left: 2px solid #94a3b8;
    border-bottom: 2px solid #ec4899;
    border-bottom-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

/* Col 2 -> Col 3 Connectors (Right of Father & Mother) */
.lineage-gen-column.gen-2 .lineage-branch-group.branch-father .lineage-node-card::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 50%;
    width: 18px;
    height: 2px;
    background: #3b82f6;
    z-index: 1;
    pointer-events: none;
}

.lineage-gen-column.gen-2 .lineage-branch-group.branch-mother .lineage-node-card::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 50%;
    width: 18px;
    height: 2px;
    background: #ec4899;
    z-index: 1;
    pointer-events: none;
}

/* Col 3: Grandparents (ปู่-ย่า 1..2, ตา-ยาย 3..4) */
.lineage-gen-column.gen-3 .lineage-branch-group.branch-father {
    grid-row: 1 / span 2;
    display: grid;
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    position: relative;
    min-width: 0;
    width: 100%;
}

.lineage-gen-column.gen-3 .lineage-branch-group.branch-father .lineage-node-card {
    align-self: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.lineage-gen-column.gen-3 .lineage-branch-group.branch-mother {
    grid-row: 3 / span 2;
    display: grid;
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    position: relative;
    min-width: 0;
    width: 100%;
}

.lineage-gen-column.gen-3 .lineage-branch-group.branch-mother .lineage-node-card {
    align-self: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Col 3 Ingress Tree Connectors */
/* Father Line (ปู่ & ย่า) */
.lineage-gen-column.gen-3 .lineage-branch-group.branch-father .lineage-node-card:first-child::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    bottom: -6px;
    width: 18px;
    border-left: 2px solid #3b82f6;
    border-top: 2px solid #3b82f6;
    border-top-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

.lineage-gen-column.gen-3 .lineage-branch-group.branch-father .lineage-node-card:nth-child(2)::before {
    content: '';
    position: absolute;
    left: -18px;
    top: -6px;
    bottom: 50%;
    width: 18px;
    border-left: 2px solid #3b82f6;
    border-bottom: 2px solid #3b82f6;
    border-bottom-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

/* Mother Line (ตา & ยาย) */
.lineage-gen-column.gen-3 .lineage-branch-group.branch-mother .lineage-node-card:first-child::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    bottom: -6px;
    width: 18px;
    border-left: 2px solid #ec4899;
    border-top: 2px solid #ec4899;
    border-top-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

.lineage-gen-column.gen-3 .lineage-branch-group.branch-mother .lineage-node-card:nth-child(2)::before {
    content: '';
    position: absolute;
    left: -18px;
    top: -6px;
    bottom: 50%;
    width: 18px;
    border-left: 2px solid #ec4899;
    border-bottom: 2px solid #ec4899;
    border-bottom-left-radius: 9px;
    pointer-events: none;
    z-index: 1;
}

/* Larger & Sleeker Node Cards */
.lineage-node-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: all 0.18s ease;
    position: relative;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}

.lineage-node-card.is-subject {
    background: #ffffff;
    border-color: #e2e8f0;
}

.lineage-node-card.is-interactive {
    cursor: pointer;
}

.lineage-node-card.is-interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
    border-color: #94a3b8;
}

.lineage-node-card.is-empty {
    border-style: dashed;
    background: #ffffff;
    opacity: 0.85;
}

.lineage-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.lineage-role-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 0;
    background: transparent;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 100%;
}

.lineage-role-tag.is-subject {
    background: transparent;
    color: #15803d;
}

.lineage-role-tag.is-father-side {
    background: transparent;
    color: #2563eb;
}

.lineage-role-tag.is-mother-side {
    background: transparent;
    color: #db2777;
}

.lineage-role-tag.is-empty {
    background: transparent;
    color: #94a3b8;
    font-weight: 500;
}

.lineage-infarm-badge {
    font-size: 9.5px;
    font-weight: 600;
    color: #15803d;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    white-space: nowrap;
}

.lineage-node-content {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.lineage-node-thumb {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.lineage-node-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lineage-node-meta {
    min-width: 0;
    max-width: calc(100% - 45px);
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.lineage-node-name {
    margin: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    line-height: 1.25;
}

.lineage-node-code {
    font-size: 10.5px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    line-height: 1.15;
}

.lineage-node-breed {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    line-height: 1.15;
}

.lineage-node-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1px;
}

.lineage-jump-link {
    font-size: 9.5px;
    font-weight: 600;
    color: #166534;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.lineage-node-empty-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 0;
    color: #94a3b8;
    font-size: 10.5px;
}

/* List View (Mobile) */
.lineage-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lineage-list-branch-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lineage-list-branch-card.branch-father {
    border-top: 4px solid #3b82f6;
}

.lineage-list-branch-card.branch-mother {
    border-top: 4px solid #ec4899;
}

.branch-card-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.branch-card-heading i {
    font-size: 22px;
}

.branch-father .branch-card-heading i { color: #2563eb; }
.branch-mother .branch-card-heading i { color: #db2777; }

.branch-card-heading h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
}

.branch-card-heading p {
    margin: 0;
    font-size: 11.5px;
    color: #64748b;
}

.branch-card-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.branch-level-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.branch-level-group .level-badge {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.branch-subgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

@media (max-width: 768px) {
    #chicken-modal #chicken-modal-dialog.is-lineage-view {
        width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 18px !important;
    }

    .lineage-popup-container {
        padding: 14px 14px 20px;
        gap: 12px;
    }

    .lineage-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 14px;
    }

    .lineage-legend {
        width: 100%;
        justify-content: space-between;
        font-size: 11px;
    }

    .lineage-mobile-view-tabs {
        display: flex;
    }

    .lineage-scroll-hint {
        display: flex;
    }
}